Unitpost Files API

Hand the API a file for one purpose, then use it by `file_id`: SMS opt-in evidence and company documents, images for templates and branding. From a URL, as base64, or with an upload session (a presigned PUT) for a local file an agent can't put in a request. Checked by their bytes, private, kept 24 hours.

GitHub OpenAPI

Operations 4

GET /files List files #
POST /files Create a file #
GET /files/{id} Retrieve a file #
DELETE /files/{id} Delete a file #

Specifications

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/unitpost-com:unitpost-com-files-api"
All apis
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.

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. 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 Specification

unitpost-com-files-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Unitpost Files API
  version: v1
  description: 'Public, versioned API for sending email and SMS and managing contacts, segments, campaigns, templates, domains, and webhooks. SMS is included on paid plans; on the free plan `POST /sms` returns `403` with `limit_reached`. Authenticate every request with an API key: `Authorization: Bearer `. A `User-Agent` header is required. Requests are scoped to the workspace that owns the key and are rate-limited per workspace. List endpoints are cursor-paginated via `limit`/`after`/`before` and return a `{ object: "list", has_more, data }` envelope. Register webhook endpoints to receive events: each create returns a `signing_secret` (`whsec_…`) exactly once. Every delivery is **svix-compatible**: it carries `svix-id`, `svix-timestamp`, and `svix-signature` (`v1,`) headers computed over `..` with your secret — verify them and reject deliveries whose signature doesn''t match (any Svix-compatible library works). Inbound email that lands on a receiving-enabled domain is readable under `/email/received`.'
servers:
- url: https://www.unitpost.com/api/v1
  description: Base URL
security:
- apiKey: []
tags:
- name: Files
  description: 'Hand the API a file for one purpose, then use it by `file_id`: SMS opt-in evidence and company documents, images for templates and branding. From a URL, as base64, or with an upload session (a presigned PUT) for a local file an agent can''t put in a request. Checked by their bytes, private, kept 24 hours.'
paths:
  /files:
    get:
      operationId: files_list
      tags:
      - Files
      summary: List files
      description: 'The workspace''s unexpired files, newest first, of the purposes this credential may use (`sms:manage`: the SMS purposes; `templates:write` or `branding:write`: `image`). `purpose` narrows it. Requires the `sms:manage` or `templates:write` or `branding:write` capability.'
      parameters:
      - name: limit
        in: query
        required: false
        description: Max rows to return (default 20, max 100).
        schema:
          type: integer
          minimum: 1
          maximum: 100
      - name: after
        in: query
        required: false
        description: Return rows after this id (forward paging).
        schema:
          type: string
      - name: before
        in: query
        required: false
        description: Return rows before this id (backward paging).
        schema:
          type: string
      - name: purpose
        in: query
        required: false
        description: Only files of this purpose.
        schema:
          type: string
          enum:
          - sms_opt_in_evidence
          - sms_document
          - image
      responses:
        '200':
          description: A page of files.
          content:
            application/json:
              schema:
                type: object
                properties:
                  object:
                    type: string
                    enum:
                    - list
                  has_more:
                    type: boolean
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/File'
                required:
                - object
                - has_more
                - data
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Insufficient scope (none of the purposes' capabilities, or not the one for `purpose`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: A bad `purpose` or pagination param, or an unknown query key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    post:
      operationId: files_create
      tags:
      - Files
      summary: Create a file
      description: 'Hand the API a file for one `purpose`, then pass its id as `file_id` (or the field an operation names) to what uses it: a brand document, a toll-free number''s opt-in evidence, a 10DLC campaign''s screenshot, a library image, the logo. Three ways in, one per call: a public https `url` (fetched once, no redirects, no private addresses); base64 `data` with `content_type` (a request body may be up to 30 MB); or an upload session, for a local file: send `content_type` and `size_bytes` without `url` or `data`, then PUT the bytes to `upload.url` with `upload.headers` within 15 minutes (`curl -T file -H "Content-Type: image/png" ""`). The bytes are checked by their contents against the purpose (`sms_opt_in_evidence`: PNG up to 400 KB; `sms_document`: PDF, PNG or JPEG up to 3 MB; `image`: PNG, JPEG, GIF or WebP up to 5 MB), never by the label. Files are private, never served back, and expire 24 hours after they''re made: what uses one keeps its own copy. Send an `Idempotency-Key` so a retry makes one file. Requires the `sms:manage` or `templates:write` or `branding:write` capability.'
      parameters:
      - name: Idempotency-Key
        in: header
        required: false
        description: Any unique string (1–256 characters, e.g. a UUID). Retrying with the same key and the same body within 24 hours returns the first result instead of sending again; the same key with a different body is `409 invalid_idempotent_request`, and one still in flight is `409 concurrent_idempotent_requests`.
        schema:
          type: string
          minLength: 1
          maxLength: 256
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FileCreate'
      responses:
        '201':
          description: 'The file: `ready`, or `awaiting_upload` with its `upload` session.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/File'
        '400':
          description: The body isn't JSON, or the `Idempotency-Key` is malformed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Insufficient scope for the purpose, or 500 unexpired files already (`limit_reached`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: An SMS purpose while SMS is not enabled.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: The `Idempotency-Key` is in use by a request still running, or with another body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '413':
          description: The file is larger than the purpose takes, or the request body is over 30 MB (`invalid_payload`). Nothing was stored.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '415':
          description: The file's contents aren't a type the purpose takes.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: A bad source (both or neither of `url`/`data` when they're needed, a URL that can't be fetched), a missing `content_type` or `size_bytes`, or an unknown key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too many files this hour; retry after the wait.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: '`engine_unavailable`: file storage isn''t configured on this deployment.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /files/{id}:
    parameters:
    - name: id
      in: path
      required: true
      schema:
        type: string
    get:
      operationId: files_get
      tags:
      - Files
      summary: Retrieve a file
      description: 'One file''s metadata (the bytes are never served back). For an upload session this checks whether the bytes arrived and pass the purpose''s checks: `ready`, `failed` (`failure_reason`), or still `awaiting_upload`. Requires the `sms:manage` or `templates:write` or `branding:write` capability.'
      responses:
        '200':
          description: The file.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/File'
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Insufficient scope.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: File not found, expired, or of a purpose this credential can't use.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: A query key (this operation takes none).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    delete:
      operationId: files_delete
      tags:
      - Files
      summary: Delete a file
      description: Delete a file and its bytes before its 24 hours are up. What already used it keeps its copy. Requires the `sms:manage` or `templates:write` or `branding:write` capability.
      responses:
        '204':
          description: Deleted.
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Insufficient scope.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: File not found, or of a purpose this credential can't use.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: A query key (this operation takes none).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    FileCreate:
      type: object
      properties:
        purpose:
          type: string
          enum:
          - sms_opt_in_evidence
          - sms_document
          - image
          description: 'What the file is for, which sets what it may be: `sms_opt_in_evidence` (PNG, up to 400 KB), `sms_document` (PDF, PNG or JPEG, up to 3 MB), `image` (PNG, JPEG, GIF or WebP, up to 5 MB). The bytes decide the type, never the name or the label.'
        url:
          description: A public https address to fetch the file from (no redirects, no private addresses, 12 seconds). One of `url`, `data`, or neither (an upload session).
          type: string
          maxLength: 2048
        data:
          description: The bytes, base64 (no `data:` prefix), with `content_type`. Base64 grows bytes by a third, and a request body may be up to 30 MB. A `url` or an upload session carries no bytes in the request.
          type: string
          maxLength: 7000000
        content_type:
          description: Required with `data` and for an upload session (it is signed into the PUT); refused with `url`.
          type: string
          enum:
          - image/png
          - application/pdf
          - image/jpeg
          - image/gif
          - image/webp
        size_bytes:
          description: 'An upload session only: the exact size of the file you''ll PUT, in bytes (signed into the PUT). Within the purpose''s maximum.'
          type: integer
          exclusiveMinimum: 0
          maximum: 9007199254740991
        filename:
          description: A name for the file (shown on what uses it). Defaults to the URL's last path part, or `file.<ext>`.
          type: string
          minLength: 1
          maxLength: 200
      required:
      - purpose
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: Stable machine-readable error code (branch on this, not the message).
            message:
              type: string
              description: 'Human-readable summary. For validation errors it''s path-prefixed (e.g. "template.variables.first_name: …").'
            details:
              type: array
              description: 'Present on errors that carry per-field reasons: validation errors (422), a blocked campaign send (409), a plan that doesn''t include a feature (403 `limit_reached` with one entry whose `code` is `feature_not_in_plan` and whose `field` names the feature, e.g. `smsChannel`), and a send cap (429 `quota_exceeded` with one entry, `field` empty, whose `code` says which cap: `daily_quota_exceeded` or `monthly_quota_exceeded` (the free plan''s daily or monthly cap), `plan_required` (the workspace needs a paid plan to send this), `allowance_used` (a paid plan''s allowance is spent and it has no pay-as-you-go), `shared_plan_cap` (the organization''s shared plan, or this workspace''s cap on it, is used up) or `risk_throttled` (the account review''s daily cap, which an upgrade doesn''t lift)). One entry per offending field/blocker.'
              items:
                type: object
                properties:
                  field:
                    type: string
                    description: Dotted path to the field, e.g. "template.variables.first_name" (empty for a whole-body problem).
                  code:
                    type: string
                    description: Machine-readable reason for this entry, when there is one (e.g. `template_not_published` on `template_id` for a blocked SMS campaign send, or `feature_not_in_plan` on `smsChannel` when the plan has no SMS). Absent on plain validation errors.
                  message:
                    type: string
                required:
                - field
                - message
            doc_url:
              type: string
              format: uri
              description: 'A page that explains this error and what to do, when there is one: an absolute link on the API''s own host. Every 429 has one (a section of the rate-limits guide: the request limit, an operation''s limit, the plan''s send caps or the account review cap), as do `sending_paused`, the SMS access review''s `sms_review_pending` and `account_under_review`, and errors about domains, API keys, idempotency keys, plan limits, billing, SMS consent and suppression. A `details[].code` with a page of its own picks it. Additive; absent otherwise.'
          required:
          - code
          - message
      required:
      - error
    File:
      type: object
      properties:
        object:
          type: string
          const: file
        id:
          type: string
        purpose:
          type: string
          enum:
          - sms_opt_in_evidence
          - sms_document
          - image
          description: 'What the file is for: `sms_opt_in_evidence` (PNG, up to 400 KB), `sms_document` (PDF, PNG or JPEG, up to 3 MB), `image` (PNG, JPEG, GIF or WebP, up to 5 MB).'
        status:
          type: string
          enum:
          - awaiting_upload
          - ready
          - failed
          description: '`ready`: checked and usable by `file_id`. `awaiting_upload`: an upload session whose bytes haven''t been PUT yet (reading the file checks again). `failed`: the uploaded bytes were refused (`failure_reason` says why).'
        filename:
          type: string
        content_type:
          type: string
          description: The type the file's bytes carry (checked by their contents), or, before an upload session's bytes arrive, the type declared.
        size_bytes:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        sha256:
          description: The hex SHA-256 of the bytes once `ready`.
          anyOf:
          - type: string
          - type: 'null'
        failure_reason:
          anyOf:
          - type: string
          - type: 'null'
        upload:
          anyOf:
          - type: object
            properties:
              url:
                type: string
                description: 'PUT the bytes here, with exactly `headers`, before `expires_at`: `curl -T <file> -H "Content-Type: …" "<url>"`. The URL is a credential for this one file: don''t share or log it.'
              method:
                type: string
                const: PUT
              headers:
                type: object
                propertyNames:
                  type: string
                additionalProperties:
                  type: string
                description: 'Send these headers with the PUT. The length and type are signed: any other size or type is refused by storage.'
              expires_at:
                type: string
                description: The URL stops working at this time (15 minutes after the file is created).
            required:
            - url
            - method
            - headers
            - expires_at
          - type: 'null'
          description: An upload session's PUT, in the create response only (null otherwise).
        created_at:
          type: string
        expires_at:
          type: string
          description: The file is deleted at this time, 24 hours after it was created, whether or not it was used. An operation that used it keeps its own copy.
      required:
      - object
      - id
      - purpose
      - status
      - filename
      - content_type
      - size_bytes
      - sha256
      - failure_reason
      - upload
      - created_at
      - expires_at
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: Your workspace API key.