> For the complete documentation index, see [llms.txt](https://docs.archera.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.archera.ai/api-reference/public-api/uploads.md).

# Uploads

API for uploading billing files for savings estimates

## Upload a billing file for a savings estimate

> Accepts a multipart PDF, CSV, JSON, or text billing file, stores it in Archera's invoice upload bucket, and returns an upload ID. Use this upload ID with the savings-estimate operation. The upload status workflow is: PENDING before storage begins, PROCESSING while the file is being transferred, COMPLETE once it is available for analysis, and ERROR if storage fails.

```json
{"openapi":"3.1.0","info":{"title":"Archera.ai API","version":"v1.0.0"},"tags":[{"name":"Uploads","description":"API for uploading billing files for savings estimates"}],"paths":{"/v1/org/{org_id}/uploads":{"post":{"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicUpload"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"405":{"description":"Method not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"422":{"$ref":"#/components/responses/UNPROCESSABLE_CONTENT"},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"default":{"$ref":"#/components/responses/DEFAULT_ERROR"}},"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/CreatePublicUpload"}}}},"tags":["Uploads"],"summary":"Upload a billing file for a savings estimate","description":"Accepts a multipart PDF, CSV, JSON, or text billing file, stores it in Archera's invoice upload bucket, and returns an upload ID. Use this upload ID with the savings-estimate operation. The upload status workflow is: PENDING before storage begins, PROCESSING while the file is being transferred, COMPLETE once it is available for analysis, and ERROR if storage fails."}}},"components":{"schemas":{"PublicUpload":{"type":"object","properties":{"id":{"type":"string","format":"uuid","readOnly":true},"created_at":{"type":"string","format":"date-time","readOnly":true},"org_id":{"type":"string","readOnly":true,"maxLength":50},"file_name":{"type":"string","readOnly":true,"maxLength":255},"content_type":{"type":"string","readOnly":true,"maxLength":255},"size_bytes":{"type":"integer","readOnly":true},"description":{"type":["string","null"],"readOnly":true,"maxLength":255},"upload_status":{"readOnly":true,"type":"string","enum":["PENDING","PROCESSING","COMPLETE","ERROR"]},"source":{"readOnly":true,"enum":["agent_upload","attachment","partner_api"]},"detected_type":{"type":["string","null"],"readOnly":true,"maxLength":64},"available_actions":{"type":"array","readOnly":true,"items":{"enum":["savings_estimate"]}}},"required":["content_type","created_at","description","detected_type","file_name","id","org_id","size_bytes","source","upload_status"],"additionalProperties":false},"ApiErrorResponse":{"type":"object","properties":{"message":{"type":"string"},"detail":{},"code":{"type":["string","null"]},"url":{"type":["string","null"]},"timestamp":{"type":"string"},"type":{"type":"string"}},"required":["message","timestamp","type"]},"Error":{"type":"object","properties":{"code":{"type":"integer","description":"Error code"},"status":{"type":"string","description":"Error name"},"message":{"type":"string","description":"Error message"},"errors":{"type":"object","description":"Errors","additionalProperties":{}}},"additionalProperties":false},"CreatePublicUpload":{"type":"object","properties":{"description":{"type":["string","null"],"maxLength":255,"description":"Optional partner-supplied context for the uploaded billing file"},"file":{"writeOnly":true,"description":"Billing PDF, CSV, JSON, or text file to upload for a savings estimate","type":"string","format":"binary"}},"required":["file"],"additionalProperties":false}},"responses":{"UNPROCESSABLE_CONTENT":{"description":"Unprocessable Content","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"DEFAULT_ERROR":{"description":"Default error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}
```

## Initiate a direct billing-file upload

> Creates a PENDING billing upload and returns a short-lived, one-write S3 PUT URL. PUT raw file bytes to upload\_url using upload\_method and every upload\_headers value; do not use multipart form data. A 412 response means the bytes already reached storage, so POST to /uploads/{upload\_id}/complete instead of retrying the PUT or initiating another upload. This is intended for clients that can access a local file but cannot pass file bytes through the API call, such as remote MCP clients.

```json
{"openapi":"3.1.0","info":{"title":"Archera.ai API","version":"v1.0.0"},"tags":[{"name":"Uploads","description":"API for uploading billing files for savings estimates"}],"paths":{"/v1/org/{org_id}/uploads/initiate":{"post":{"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicUploadInitiation"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"405":{"description":"Method not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"422":{"$ref":"#/components/responses/UNPROCESSABLE_CONTENT"},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"default":{"$ref":"#/components/responses/DEFAULT_ERROR"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePublicUploadInitiation"}}}},"tags":["Uploads"],"summary":"Initiate a direct billing-file upload","description":"Creates a PENDING billing upload and returns a short-lived, one-write S3 PUT URL. PUT raw file bytes to upload_url using upload_method and every upload_headers value; do not use multipart form data. A 412 response means the bytes already reached storage, so POST to /uploads/{upload_id}/complete instead of retrying the PUT or initiating another upload. This is intended for clients that can access a local file but cannot pass file bytes through the API call, such as remote MCP clients."}}},"components":{"schemas":{"PublicUploadInitiation":{"type":"object","properties":{"upload_id":{"type":"string","format":"uuid","readOnly":true},"upload_url":{"type":"string","readOnly":true},"upload_method":{"type":"string","readOnly":true},"upload_headers":{"type":"object","readOnly":true,"additionalProperties":{"type":"string"}}},"required":["upload_headers","upload_id","upload_method","upload_url"],"additionalProperties":false},"ApiErrorResponse":{"type":"object","properties":{"message":{"type":"string"},"detail":{},"code":{"type":["string","null"]},"url":{"type":["string","null"]},"timestamp":{"type":"string"},"type":{"type":"string"}},"required":["message","timestamp","type"]},"Error":{"type":"object","properties":{"code":{"type":"integer","description":"Error code"},"status":{"type":"string","description":"Error name"},"message":{"type":"string","description":"Error message"},"errors":{"type":"object","description":"Errors","additionalProperties":{}}},"additionalProperties":false},"CreatePublicUploadInitiation":{"type":"object","properties":{"file_name":{"type":"string","maxLength":255},"content_type":{"type":"string","maxLength":255},"size_bytes":{"type":"integer","minimum":1},"description":{"type":["string","null"],"maxLength":255,"description":"Optional partner-supplied context for the uploaded billing file"}},"required":["content_type","file_name","size_bytes"],"additionalProperties":false}},"responses":{"UNPROCESSABLE_CONTENT":{"description":"Unprocessable Content","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"DEFAULT_ERROR":{"description":"Default error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}
```

## Complete a direct billing-file upload

> Verifies that the file from a direct upload has reached storage at its declared size, then marks the upload COMPLETE so it can be used by the savings-estimate operation.

```json
{"openapi":"3.1.0","info":{"title":"Archera.ai API","version":"v1.0.0"},"tags":[{"name":"Uploads","description":"API for uploading billing files for savings estimates"}],"paths":{"/v1/org/{org_id}/uploads/{upload_id}/complete":{"post":{"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicUpload"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"405":{"description":"Method not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"default":{"$ref":"#/components/responses/DEFAULT_ERROR"}},"tags":["Uploads"],"summary":"Complete a direct billing-file upload","description":"Verifies that the file from a direct upload has reached storage at its declared size, then marks the upload COMPLETE so it can be used by the savings-estimate operation."}}},"components":{"schemas":{"PublicUpload":{"type":"object","properties":{"id":{"type":"string","format":"uuid","readOnly":true},"created_at":{"type":"string","format":"date-time","readOnly":true},"org_id":{"type":"string","readOnly":true,"maxLength":50},"file_name":{"type":"string","readOnly":true,"maxLength":255},"content_type":{"type":"string","readOnly":true,"maxLength":255},"size_bytes":{"type":"integer","readOnly":true},"description":{"type":["string","null"],"readOnly":true,"maxLength":255},"upload_status":{"readOnly":true,"type":"string","enum":["PENDING","PROCESSING","COMPLETE","ERROR"]},"source":{"readOnly":true,"enum":["agent_upload","attachment","partner_api"]},"detected_type":{"type":["string","null"],"readOnly":true,"maxLength":64},"available_actions":{"type":"array","readOnly":true,"items":{"enum":["savings_estimate"]}}},"required":["content_type","created_at","description","detected_type","file_name","id","org_id","size_bytes","source","upload_status"],"additionalProperties":false},"ApiErrorResponse":{"type":"object","properties":{"message":{"type":"string"},"detail":{},"code":{"type":["string","null"]},"url":{"type":["string","null"]},"timestamp":{"type":"string"},"type":{"type":"string"}},"required":["message","timestamp","type"]},"Error":{"type":"object","properties":{"code":{"type":"integer","description":"Error code"},"status":{"type":"string","description":"Error name"},"message":{"type":"string","description":"Error message"},"errors":{"type":"object","description":"Errors","additionalProperties":{}}},"additionalProperties":false}},"responses":{"DEFAULT_ERROR":{"description":"Default error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}
```

## Get uploaded billing file status

> Returns metadata and upload status for a partner API upload. Clients can poll this endpoint until upload\_status is COMPLETE, then pass the upload ID to the savings-estimate operation.

```json
{"openapi":"3.1.0","info":{"title":"Archera.ai API","version":"v1.0.0"},"tags":[{"name":"Uploads","description":"API for uploading billing files for savings estimates"}],"paths":{"/v1/org/{org_id}/uploads/{upload_id}":{"get":{"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicUpload"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"405":{"description":"Method not allowed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"default":{"$ref":"#/components/responses/DEFAULT_ERROR"}},"tags":["Uploads"],"summary":"Get uploaded billing file status","description":"Returns metadata and upload status for a partner API upload. Clients can poll this endpoint until upload_status is COMPLETE, then pass the upload ID to the savings-estimate operation."}}},"components":{"schemas":{"PublicUpload":{"type":"object","properties":{"id":{"type":"string","format":"uuid","readOnly":true},"created_at":{"type":"string","format":"date-time","readOnly":true},"org_id":{"type":"string","readOnly":true,"maxLength":50},"file_name":{"type":"string","readOnly":true,"maxLength":255},"content_type":{"type":"string","readOnly":true,"maxLength":255},"size_bytes":{"type":"integer","readOnly":true},"description":{"type":["string","null"],"readOnly":true,"maxLength":255},"upload_status":{"readOnly":true,"type":"string","enum":["PENDING","PROCESSING","COMPLETE","ERROR"]},"source":{"readOnly":true,"enum":["agent_upload","attachment","partner_api"]},"detected_type":{"type":["string","null"],"readOnly":true,"maxLength":64},"available_actions":{"type":"array","readOnly":true,"items":{"enum":["savings_estimate"]}}},"required":["content_type","created_at","description","detected_type","file_name","id","org_id","size_bytes","source","upload_status"],"additionalProperties":false},"ApiErrorResponse":{"type":"object","properties":{"message":{"type":"string"},"detail":{},"code":{"type":["string","null"]},"url":{"type":["string","null"]},"timestamp":{"type":"string"},"type":{"type":"string"}},"required":["message","timestamp","type"]},"Error":{"type":"object","properties":{"code":{"type":"integer","description":"Error code"},"status":{"type":"string","description":"Error name"},"message":{"type":"string","description":"Error message"},"errors":{"type":"object","description":"Errors","additionalProperties":{}}},"additionalProperties":false}},"responses":{"DEFAULT_ERROR":{"description":"Default error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.archera.ai/api-reference/public-api/uploads.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
