Expensicat
API Reference

Documents

GET
/v1/documents

List documents with filtering and pagination

Authorization

bearerAuth
AuthorizationBearer <token>

Session JWT or OAuth2 access token

In: header

Query Parameters

cursor?string

Pagination cursor

limit?integer

Number of items per page (1-100; higher values cap at 100)

Range1 <= value
Default20
category?string

Value in

  • "receipt"
  • "invoice"
  • "contract"
  • "tax"
  • "insurance"
  • "legal"
  • "report"
  • "bank_statement"
  • "other"
folder_id?string
include_deleted?boolean|null

Response Body

application/json

application/json

curl -X GET "https://example.com/v1/documents"
{  "data": [    {      "id": "string",      "organization_id": "string",      "storage_object_id": "string",      "category": "receipt",      "folder_id": "string",      "deleted_at": "string",      "deleted_by": "string",      "created_at": "string",      "updated_at": "string",      "file_name": "string",      "file_path": "string",      "content_type": "string",      "size": 0,      "source": "string",      "primary_attachment": {        "attachable_type": "string",        "attachable_id": "string",        "entry_name": "string",        "invoice_number": "string"      }    }  ],  "meta": {    "count": 0,    "next_cursor": "string"  }}
POST
/v1/documents

Create a document from a file. Use source_key (assistant/) to copy from assistant bucket, or file_path (vault/) for files already in vault.

Authorization

bearerAuth
AuthorizationBearer <token>

Session JWT or OAuth2 access token

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/documents" \  -H "Content-Type: application/json" \  -d '{    "category": "receipt"  }'
{  "data": {    "id": "string",    "organization_id": "string",    "storage_object_id": "string",    "category": "receipt",    "folder_id": "string",    "deleted_at": "string",    "deleted_by": "string",    "created_at": "string",    "updated_at": "string",    "file_name": "string",    "file_path": "string",    "content_type": "string",    "size": 0,    "source": "string",    "primary_attachment": {      "attachable_type": "string",      "attachable_id": "string",      "entry_name": "string",      "invoice_number": "string"    },    "attachments": [      {        "id": "string",        "attachable_type": "string",        "attachable_id": "string",        "is_primary": true,        "label": "string"      }    ]  }}
GET
/v1/documents/counts

Get document counts grouped by category

Authorization

bearerAuth
AuthorizationBearer <token>

Session JWT or OAuth2 access token

In: header

Response Body

application/json

application/json

curl -X GET "https://example.com/v1/documents/counts"
{  "data": {    "all": 0,    "receipt": 0,    "invoice": 0,    "contract": 0,    "tax": 0,    "insurance": 0,    "legal": 0,    "report": 0,    "bank_statement": 0,    "other": 0,    "trash": 0  }}
GET
/v1/documents/{id}

Get a single document by ID with attachments

Authorization

bearerAuth
AuthorizationBearer <token>

Session JWT or OAuth2 access token

In: header

Path Parameters

id*string

Response Body

application/json

application/json

application/json

curl -X GET "https://example.com/v1/documents/string"
{  "data": {    "id": "string",    "organization_id": "string",    "storage_object_id": "string",    "category": "receipt",    "folder_id": "string",    "deleted_at": "string",    "deleted_by": "string",    "created_at": "string",    "updated_at": "string",    "file_name": "string",    "file_path": "string",    "content_type": "string",    "size": 0,    "source": "string",    "primary_attachment": {      "attachable_type": "string",      "attachable_id": "string",      "entry_name": "string",      "invoice_number": "string"    },    "attachments": [      {        "id": "string",        "attachable_type": "string",        "attachable_id": "string",        "is_primary": true,        "label": "string"      }    ]  }}
PATCH
/v1/documents/{id}

Update document category

Authorization

bearerAuth
AuthorizationBearer <token>

Session JWT or OAuth2 access token

In: header

Path Parameters

id*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X PATCH "https://example.com/v1/documents/string" \  -H "Content-Type: application/json" \  -d '{}'
{  "data": {    "id": "string",    "organization_id": "string",    "storage_object_id": "string",    "category": "receipt",    "folder_id": "string",    "deleted_at": "string",    "deleted_by": "string",    "created_at": "string",    "updated_at": "string",    "file_name": "string",    "file_path": "string",    "content_type": "string",    "size": 0,    "source": "string",    "primary_attachment": {      "attachable_type": "string",      "attachable_id": "string",      "entry_name": "string",      "invoice_number": "string"    },    "attachments": [      {        "id": "string",        "attachable_type": "string",        "attachable_id": "string",        "is_primary": true,        "label": "string"      }    ]  }}
DELETE
/v1/documents/{id}

Soft delete a document (move to trash)

Authorization

bearerAuth
AuthorizationBearer <token>

Session JWT or OAuth2 access token

In: header

Path Parameters

id*string

Response Body

application/json

application/json

curl -X DELETE "https://example.com/v1/documents/string"
Empty
POST
/v1/documents/{id}/restore

Restore a document from trash

Authorization

bearerAuth
AuthorizationBearer <token>

Session JWT or OAuth2 access token

In: header

Path Parameters

id*string

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/documents/string/restore"
{  "data": {    "id": "string",    "organization_id": "string",    "storage_object_id": "string",    "category": "receipt",    "folder_id": "string",    "deleted_at": "string",    "deleted_by": "string",    "created_at": "string",    "updated_at": "string",    "file_name": "string",    "file_path": "string",    "content_type": "string",    "size": 0,    "source": "string",    "primary_attachment": {      "attachable_type": "string",      "attachable_id": "string",      "entry_name": "string",      "invoice_number": "string"    },    "attachments": [      {        "id": "string",        "attachable_type": "string",        "attachable_id": "string",        "is_primary": true,        "label": "string"      }    ]  }}
DELETE
/v1/documents/{id}/permanent

Permanently delete a document from trash (cannot be undone)

Authorization

bearerAuth
AuthorizationBearer <token>

Session JWT or OAuth2 access token

In: header

Path Parameters

id*string

Response Body

application/json

application/json

application/json

curl -X DELETE "https://example.com/v1/documents/string/permanent"
Empty