usewrit-app Files API

OpenAI-style encrypted-at-rest file handles (metadata + byte I/O).

Operations 6

GET /v1/files List file handles #
POST /v1/files Upload a file (multipart) #
POST /v1/files/from-data Export workflow data into a file #
GET /v1/files/{id} Get one file handle #
DELETE /v1/files/{id} Delete a file #
GET /v1/files/{id}/content Download file bytes #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • 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.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/usewrit-app:usewrit-app-files-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API 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. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

usewrit-app-files-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Writ Agent Files API
  version: 0.1.0
  license:
    name: MIT
    identifier: MIT
  description: 'Loopback HTTP API of the Writ local agent (`writ-agentd`), the daemon embedded in the

    Writ desktop app and the self-host build. This document is generated against the Rust

    daemon source (`writ-agent/src/local/`), which is the wire truth.


    ## Transport


    - Plain HTTP on `127.0.0.1:8131` (default; `WRIT_PORT` env overrides).

    - Optional HTTPS twin on `127.0.0.1:8132`, served with a certificate minted by a

    per-install, name-constrained local CA (`~/.writ/tls/ca.pem`). Clients must trust that

    CA file (or pin it) to use the TLS port; the payloads are identical on both ports.

    - The daemon enforces a DNS-rebind guard: `Host`/`Origin` must be loopback. Talk to

    `127.0.0.1`, not `localhost`.


    ## Errors


    Domain errors are JSON `{"error": "", "code": ""}` (see the

    `Error` schema). Codes include `bad_request`, `unauthorized`, `forbidden`, `not_found`,

    `vault_locked` (HTTP 423), `too_many_requests`, `device_capacity` (HTTP 409),

    `captcha_required` (HTTP 402), `internal`.


    **Caveat:** some 4xx bodies are `text/plain`, not JSON — axum framework rejections

    (e.g. a JSON body that fails to deserialize returns

    `Failed to deserialize the JSON body into the target type: missing field ''url''` as

    plain text with a 4xx status). Clients must tolerate non-JSON error bodies.


    ## List envelopes


    The wire is deliberately documented as-is (SDKs normalize; this spec does not):


    - `{"data": [...], "count": n}` — workflows, personas, persona runs, secrets, files, keys

    - `{"data": [...], "count": n, "total": n}` — runs

    - **bare JSON array** — monitors, monitor selectors, extractors, automations,

    `/v1/changes/recent`

    - bespoke objects — `/v1/monitors/{id}/changes`, `/v1/data`, the workflow-data table'
servers:
- url: http://127.0.0.1:8131
  description: Plain-HTTP loopback listener (default port; WRIT_PORT overrides).
- url: https://127.0.0.1:8132
  description: HTTPS twin of the same API, terminated with a certificate from the per-install local CA at ~/.writ/tls/ca.pem. Trust that CA (or pin it) in your HTTP client.
security:
- bearerAuth: []
tags:
- name: Files
  description: OpenAI-style encrypted-at-rest file handles (metadata + byte I/O).
paths:
  /v1/files:
    get:
      operationId: listFiles
      tags:
      - Files
      summary: List file handles
      description: Newest-first live (not soft-deleted) file handles in the `{data, count}` envelope.
      parameters:
      - name: limit
        in: query
        description: Page size (clamped to 1..=500; default 100).
        schema:
          type: integer
          format: int64
          default: 100
      - name: source
        in: query
        description: Optional source filter.
        schema:
          type: string
          enum:
          - upload
          - api
          - workflow_output
      responses:
        '200':
          description: File-handle page in the `{data, count}` envelope.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileList'
        '401':
          $ref: '#/components/responses/Unauthorized'
    post:
      operationId: uploadFile
      tags:
      - Files
      summary: Upload a file (multipart)
      description: Multipart upload. The first part carrying a filename (or named `file`) is the content; an optional `source` text part overrides the default `upload` source. Bytes are encrypted at rest; uploads over 50 MiB are rejected with a 400.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
              - file
              properties:
                file:
                  type: string
                  format: binary
                  description: The file content part (any field name with a filename is accepted).
                source:
                  type: string
                  enum:
                  - upload
                  - api
                  - workflow_output
                  description: Optional source override (defaults to `upload`).
            encoding:
              file:
                contentType: application/octet-stream
      responses:
        '200':
          description: The new file handle.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StoredFile'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /v1/files/from-data:
    post:
      operationId: createFileFromData
      tags:
      - Files
      summary: Export workflow data into a file
      description: Exports a workflow's extracted data (with the same meta/secret redaction the Data surface applies) into an encrypted-at-rest stored file with `source = "workflow_output"`.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FileFromDataRequest'
      responses:
        '200':
          description: The new file handle.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StoredFile'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
  /v1/files/{id}:
    parameters:
    - $ref: '#/components/parameters/FileId'
    get:
      operationId: getFile
      tags:
      - Files
      summary: Get one file handle
      description: One live file's metadata (soft-deleted handles read as absent).
      responses:
        '200':
          description: The file handle.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StoredFile'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
    delete:
      operationId: deleteFile
      tags:
      - Files
      summary: Delete a file
      description: Soft-delete (status becomes `deleted`); on-disk bytes are reclaimed by storage GC.
      responses:
        '200':
          description: Deletion acknowledgement.
          content:
            application/json:
              schema:
                type: object
                required:
                - id
                - deleted
                properties:
                  id:
                    type: string
                  deleted:
                    type: boolean
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
  /v1/files/{id}/content:
    get:
      operationId: downloadFileContent
      tags:
      - Files
      summary: Download file bytes
      description: Decrypts and streams the handle's bytes with the recorded content type and an `attachment` Content-Disposition carrying the original filename.
      parameters:
      - $ref: '#/components/parameters/FileId'
      responses:
        '200':
          description: The raw file bytes. The Content-Type is the stored content type of the file (documented here as `application/octet-stream` for codegen purposes).
          content:
            application/octet-stream:
              schema:
                type: string
                format: binary
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  schemas:
    Error:
      type: object
      description: 'The daemon''s domain error body. NOTE: some 4xx responses (axum framework rejections) are `text/plain` instead of this JSON shape. Certain codes attach extra fields (e.g. `device_capacity` adds `would_use_units_per_min` / `budget_units_per_min`; `captcha_required` adds `captcha_type` / `url`).'
      required:
      - error
      - code
      properties:
        error:
          type: string
          description: 'Human-readable message (e.g. `not found: workflow 999999`).'
        code:
          type: string
          description: 'Stable machine code: `bad_request`, `unauthorized`, `forbidden`, `not_found`, `vault_locked`, `too_many_requests`, `captcha_required`, `device_capacity`, `cloud_unreachable`, `db_error`, `io_error`, `json_error`, `internal`, …'
      additionalProperties: true
    FileFromDataRequest:
      type: object
      description: Body for `POST /v1/files/from-data`.
      required:
      - workflow_id
      properties:
        workflow_id:
          type: integer
          format: int64
        format:
          type:
          - string
          - 'null'
          enum:
          - csv
          - json
          - null
          description: Defaults to `csv`.
        filters:
          description: Optional structured-filter array (same clause schema as the data table's `filters` param).
          type:
          - array
          - 'null'
    FileList:
      type: object
      description: '`{data, count}` list envelope.'
      required:
      - data
      - count
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/StoredFile'
        count:
          type: integer
    StoredFile:
      type: object
      description: OpenAI-style file handle (`api/v1/files.rs::WireStoredFile`). Note `bytes` (not `size_bytes`) and `created_at` as UNIX epoch SECONDS (not RFC3339).
      required:
      - id
      - object
      - filename
      - content_type
      - bytes
      - created_at
      - status
      - source
      - purpose
      properties:
        id:
          type: string
          description: '`file_<hex>` handle id.'
        object:
          type: string
          const: file
        filename:
          type: string
        content_type:
          type: string
        bytes:
          type: integer
          format: int64
          description: Size in bytes.
        created_at:
          type: integer
          format: int64
          description: UNIX epoch seconds (0 when the stored timestamp is malformed).
        status:
          type: string
        source:
          type: string
          enum:
          - upload
          - api
          - workflow_output
        purpose:
          type: string
          description: Defaults to `user_data`.
  responses:
    NotFound:
      description: The addressed resource does not exist.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Missing/invalid bearer token, or the Origin/Host guard rejected the request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    BadRequest:
      description: 'Invalid input. Domain validation errors use the JSON Error shape; axum body-deserialize rejections are `text/plain` with a bare message (e.g. `Failed to deserialize the JSON body into the target type: missing field ''url''`).'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
        text/plain:
          schema:
            type: string
  parameters:
    FileId:
      name: id
      in: path
      required: true
      description: File handle id (`file_<hex>`).
      schema:
        type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: "Every route (including `/v1/agent` and `/v1/health`) requires\n`Authorization: Bearer <token>`. Token families:\n\n- `wlt_…` — the runtime token from `runtime.json` (full access, used by the desktop\n  UI and SDK discovery).\n- `wlk_…` — a scoped API key minted via `POST /v1/keys` (CSV scopes `read|run|admin`;\n  `/v1/keys` itself requires the full-access token).\n- `wlo_…` — an OAuth 2.1 access token from the daemon's local authorization server\n  (`run` scope).\n\nTreat the token as an opaque string. The daemon additionally enforces a loopback\nOrigin/Host DNS-rebind guard.\n"