Reason Machines Attachments API
Files uploaded to the organization and shared with sessions, downloaded via short-lived signed URLs.
Files uploaded to the organization and shared with sessions, downloaded via short-lived signed URLs.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/reasonmachines-com:reasonmachines-com-attachments-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Reason Attachments API
version: 3.0.0
description: 'The Reason HTTP API. Drive cloud software-engineering agents: open sessions against your repositories, stream their work, and manage the secrets, skills, and automations they run with.
Authenticate with a Reason API key sent as a bearer token. New keys use `reason_`; legacy `ara_` keys remain accepted. Every resource is scoped to an organization; resolve your `org_id` once with `GET /v3/self`.'
servers:
- url: https://api.reasonmachines.com
security:
- reasonApiKey: []
tags:
- name: Attachments
description: Files uploaded to the organization and shared with sessions, downloaded via short-lived signed URLs.
paths:
/v3/organizations/{orgId}/attachments:
parameters:
- $ref: '#/components/parameters/orgId'
get:
operationId: listAttachments
x-reason-mcp-description: Lists files uploaded to the workspace, newest first, to find an `id` for `downloadAttachment` or `deleteAttachment`. Each item has `id`, `name`, `content_type`, `size_bytes`, `created_at` and a short-lived `url` (null when unsigned). Pass `end_cursor` as `cursor` while `has_next_page` is true.
tags:
- Attachments
summary: List attachments
description: 'Returns the files uploaded to the organization, newest first. Paginates by offset: pass `cursor` from the previous page''s `end_cursor` to fetch the next page.
Scope: `attachments:read`'
responses:
'200':
description: Attachments.
content:
application/json:
schema:
type: object
properties:
items:
type: array
items:
$ref: '#/components/schemas/Attachment'
description: Uploaded files on this page, newest first.
end_cursor:
description: Pass as `cursor` for the next page; null on the last page.
type:
- string
- 'null'
has_next_page:
type: boolean
description: Whether more files follow this page.
required:
- items
- end_cursor
- has_next_page
example:
items:
- id: att_7b1
name: spec.pdf
content_type: application/pdf
size_bytes: 88213
url: https://...
created_at: '2026-06-23T20:10:00Z'
end_cursor: null
has_next_page: false
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'429':
$ref: '#/components/responses/RateLimited'
parameters:
- in: query
name: limit
schema:
type: integer
default: 50
description: How many uploaded files to return in this page; a larger value is capped at 100.
- in: query
name: cursor
schema:
type: string
description: Offset cursor from the previous page's `end_cursor`.
security:
- reasonApiKey:
- attachments:read
post:
operationId: createAttachment
x-reason-mcp-description: Uploads a file to the workspace, from `filename` and base64 `data_base64` of up to 1 MiB, so it can be referenced or downloaded later. Returns the new `id`, `name` and a short-lived download `url`, which can be null. The stored content type is derived from the bytes, not the filename.
tags:
- Attachments
summary: Upload an attachment
description: 'Uploads a file to the organization. Send the file as multipart/form-data in the file field. Maximum file size: 25 MiB (26214400 bytes). Oversized files return HTTP 413; missing files return HTTP 400 file_required. Download URLs are short-lived and may be null. The stored `content_type` is derived from the file''s bytes, never from the type or file name you send: an image or video keeps its media type, plain UTF-8 text (including source and markup) is `text/plain; charset=utf-8`, and anything else is `application/octet-stream`. Every file downloads as an attachment.
Scope: `attachments:write`'
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
required:
- file
properties:
file:
type: string
format: binary
description: The file to upload.
responses:
'201':
description: The created attachment.
content:
application/json:
schema:
$ref: '#/components/schemas/AttachmentCreateResponse'
example:
id: att_91af3c
name: requirements.txt
url: null
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'413':
description: The file exceeds the maximum upload size.
content:
application/json:
schema:
type: object
required:
- error
- max_bytes
properties:
error:
type: string
const: attachment_too_large
max_bytes:
type: integer
example:
error: attachment_too_large
max_bytes: 26214400
'429':
$ref: '#/components/responses/RateLimited'
'503':
description: '`attachment_storage_unavailable`: file storage is not configured on this local or CI server, so nothing was stored.'
security:
- reasonApiKey:
- attachments:write
/v3/organizations/{orgId}/attachments/{attachmentId}:
parameters:
- $ref: '#/components/parameters/orgId'
- name: attachmentId
description: 'The attachment id. On the workspace attachment routes: `id` from `listAttachments` or `createAttachment`. On the Session route: an id from `listSessionAttachments`, or a sent file''s id from a `listSessionConversation` or `listSessionMessages` item.'
in: path
required: true
schema:
type: string
get:
operationId: downloadAttachment
x-reason-mcp-description: 'Gets a short-lived signed `download_url`, with `expires_at` when the link states one, for one workspace attachment: an id from `listAttachments` or `createAttachment` (a Session''s files: `getSessionAttachment`). Fetch the link with a plain GET and no Authorization header; an unknown id returns 404.'
tags:
- Attachments
summary: Download an attachment
description: 'Redirects (307) to a short-lived signed download URL for the attachment.
Scope: `attachments:read`'
responses:
'307':
description: Redirect to the attachment's signed download URL.
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'429':
$ref: '#/components/responses/RateLimited'
security:
- reasonApiKey:
- attachments:read
delete:
operationId: deleteAttachment
x-reason-mcp-description: Deletes a file uploaded to the workspace permanently, with its stored bytes, and returns `ok` and the deleted `id`. Uploaders can delete their own files; owners and admins can delete any. Files kept by a session's agent are a separate store and are unaffected.
tags:
- Attachments
summary: Delete an attachment
description: 'Permanently delete a file uploaded to the organization, with its stored bytes. You delete your own uploads; workspace owners and admins can delete any.
Permanently deletes a file uploaded to the organization, and its stored bytes. You can delete an attachment you uploaded; workspace owners and admins can delete any. Deleting a teammate''s attachment without that role returns 403. An id that is not an attachment of this organization, or was already deleted, returns 404 attachment_not_found and deletes nothing. Session attachments (files a session''s agent kept) are a separate store and are not affected.
Scope: `attachments:write`'
responses:
'200':
description: Attachment deleted.
content:
application/json:
schema:
$ref: '#/components/schemas/AttachmentDeleted'
example:
ok: true
id: 5b0c6a0e-3c2f-4a51-9b1e-7d0c6c1f2a44
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'429':
$ref: '#/components/responses/RateLimited'
security:
- reasonApiKey:
- attachments:write
/v3/organizations/{orgId}/attachments/{attachmentId}/{filename}:
parameters:
- $ref: '#/components/parameters/orgId'
- name: attachmentId
description: 'The attachment id. On the workspace attachment routes: `id` from `listAttachments` or `createAttachment`. On the Session route: an id from `listSessionAttachments`, or a sent file''s id from a `listSessionConversation` or `listSessionMessages` item.'
in: path
required: true
schema:
type: string
- name: filename
description: Cosmetic filename for the downloaded file; not validated against the stored name.
in: path
required: true
schema:
type: string
get:
operationId: downloadAttachmentWithFilename
x-reason-mcp-description: 'Works like `downloadAttachment` for clients that save the file under a chosen name: returns a short-lived signed `download_url`, with `expires_at` when known. The trailing `filename` only names the download and is not checked against the stored name. Fetch the link with no Authorization header.'
tags:
- Attachments
summary: Download an attachment (named)
description: 'Same 307 redirect as the bare download route; the trailing filename gives naive clients the right file name.
Scope: `attachments:read`'
responses:
'307':
description: Redirect to the attachment's signed download URL.
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'429':
$ref: '#/components/responses/RateLimited'
security:
- reasonApiKey:
- attachments:read
components:
responses:
NotFound:
description: Resource not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error: session_not_found
Unauthorized:
description: Missing, invalid, or expired key.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error: missing_bearer
message: Authorization required
BadRequest:
description: Invalid request.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error: prompt_required
Forbidden:
description: The key lacks the required scope or role.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error: missing_scope
required_scope: sessions:read
RateLimited:
description: Too many requests. Retry after the number of seconds in the `Retry-After` response header.
headers:
Retry-After:
description: Seconds to wait before retrying.
schema:
type: integer
minimum: 1
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error:
type: rate_limited
message: This API key exceeded its request-rate limit
schemas:
Error:
type: object
properties:
error:
oneOf:
- type: string
- type: object
required:
- type
- message
properties:
type:
type: string
message:
type: string
request_id:
type:
- string
- 'null'
message:
type: string
required_scope:
type: string
description: The capability required when the request was denied for a missing scope.
AttachmentCreateResponse:
type: object
properties:
id:
type: string
description: Attachment id, as `attachmentId` for downloading or deleting the file.
name:
type: string
description: File name stored with the upload.
url:
description: A signed download URL, or null when the file cannot be signed. Use the download endpoint for a fresh URL.
type:
- string
- 'null'
required:
- id
- name
- url
Attachment:
type: object
properties:
id:
type: string
description: Attachment id, as `attachmentId` for downloading or deleting the file.
name:
type: string
description: File name stored with the upload.
content_type:
type: string
description: Media type derived from the file's bytes, not from its name.
size_bytes:
type: integer
description: File size in bytes.
url:
description: A signed download URL, or null when the file cannot be signed. Use the download endpoint for a fresh URL.
type:
- string
- 'null'
created_at:
type: string
format: date-time
description: When the file was uploaded.
required:
- id
- name
- content_type
- size_bytes
- url
- created_at
AttachmentDeleted:
type: object
properties:
ok:
type: boolean
const: true
description: 'Always true: the attachment record is deleted, so the API no longer lists it or issues download links for it; its stored bytes are removed on a best-effort basis, so a link issued earlier may work until it expires.'
id:
type: string
description: Id of the deleted attachment.
required:
- ok
- id
parameters:
orgId:
name: orgId
in: path
required: true
description: Organization id or slug. Resolve it with `GET /v3/self`.
schema:
type: string
securitySchemes:
loopWebhookKey:
type: http
scheme: bearer
description: A Loop's webhook key, returned once by the createReasonLoop or updateReasonLoop call that adds the webhook. It only delivers events to that Loop's webhook; every other operation rejects it.
loopWebhookSignature:
type: apiKey
in: header
name: X-Signature-256
description: 'An HMAC-SHA256 of the exact request body keyed with the Loop''s webhook key or its stored signing secret: hex in `X-Signature-256` (optionally `sha256=`-prefixed), or the sender''s own header (`X-Hub-Signature-256`, `Stripe-Signature`, `Webhook-Signature`, `Svix-Signature`, `Linear-Signature`, `Sentry-Hook-Signature`, `X-Shopify-Hmac-Sha256`).'
reasonMachineToken:
type: http
scheme: bearer
bearerFormat: rmt_<hex>
description: A Machine token from createMachineToken. It can only create enrollment tickets for its own Machine; every other operation rejects it.
reasonUserOAuth:
type: http
scheme: bearer
description: A workspace-bound human user OAuth grant with org:write scope. The user must be an organization owner/admin. API keys and browser sessions are not accepted.
reasonApiKey:
type: http
scheme: bearer
bearerFormat: 'reason_<hex> (legacy: ara_<hex>)'
description: 'Your Reason API key from Settings › API keys. New keys use `reason_`; legacy `ara_` keys remain accepted. Keys are capability-scoped: run, mcp:read, mcp:write, secrets:read, secrets:write, sessions:read, sessions:debug, devices:read, devices:write, devices:use, computers:read, computers:write, ssh:write, knowledge:read, memory:read, memory:write, skills:read, skills:write, pages:read, pages:write, repos:read, repos:write, reviews:read, reviews:write, deployment:read, analytics:read, org:read, org:write, attachments:read, attachments:write, guardrails:read, guardrails:write, network:read, network:write, automations:read, automations:write, agent_auth:read. devices:write, devices:use, computers:read, computers:write, ssh:write, network:read and network:write are opt-in, excluded from default keys. computers:read lists visible cloud and connected computers without waking them or granting execution access. devices:read discovers local Device targets; devices:use separately consents to local execution, so a discover-and-run local workflow needs both. devices:write manages enrollment and device grants; computers:write creates or deletes cloud computers; ssh:write manages retained SSH access. network:read reads the saved workspace network policy; network:write replaces custom allowed hosts and requires a current organization owner/admin. Legacy project PATCH requests containing network_allowed_hosts also require network:write plus their existing run scope and project management permission; saved project hosts do not affect current session egress. Only owners/admins can mint or manage keys with network:write; keys cannot grant themselves more authority. See /docs/network-policies for replacement semantics and runtime applicability. mcp:write manages MCP server configuration only; it does not authorize remote MCP-tool execution. sessions:read reads sessions, including the assistant, reasoning and tool activity in their events. sessions:debug is privileged: only for organization owners/admins, it expands session events to the full diagnostic projection (diagnostic event kinds, status text and raw event metadata).'