List files

List files

GET/api/v1/files

GET /files
curl -X GET 'https://www.unitpost.com/api/v1/files' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0'
Response · 200
{
  "object": "list",
  "has_more": false,
  "data": [
    {
      "object": "file",
      "id": "id_123",
      "purpose": "sms_opt_in_evidence",
      "status": "awaiting_upload",
      "filename": "string",
      "content_type": "string",
      "size_bytes": 1,
      "sha256": "string",
      "failure_reason": "string",
      "upload": {
        "url": "https://example.com",
        "method": "PUT",
        "headers": {},
        "expires_at": "2026-01-01T00:00:00.000Z"
      },
      "created_at": "2026-01-01T00:00:00.000Z",
      "expires_at": "2026-01-01T00:00:00.000Z"
    }
  ]
}

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.

Parameters4 fields
FieldTypeDescription
limitinteger · queryMax rows to return (default 20, max 100).
afterstring · queryReturn rows after this id (forward paging).
beforestring · queryReturn rows before this id (backward paging).
purposestring · queryOnly files of this purpose.
Response · 200 fields12 fields
FieldTypeDescription
objectrequiredstring—
idrequiredstring—
purposerequiredenumsms_opt_in_evidence | sms_document | imageWhat 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).
statusrequiredenumawaiting_upload | ready | failed`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).
filenamerequiredstring—
content_typerequiredstringThe type the file's bytes carry (checked by their contents), or, before an upload session's bytes arrive, the type declared.
size_bytesrequiredinteger—
sha256requiredstring | nullThe hex SHA-256 of the bytes once `ready`.
failure_reasonrequiredstring | null—
uploadrequiredobject | nullAn upload session's PUT, in the create response only (null otherwise).
created_atrequiredstring—
expires_atrequiredstringThe 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.
200401403422

Search docs and guides

Search the docs and product guides.