> For the complete documentation index, see [llms.txt](https://docs.usepylon.com/pylon-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.usepylon.com/pylon-docs/developer/api/api-reference/accounts/files.md). Agents can also search and read this documentation through its [MCP server](https://docs.usepylon.com/pylon-docs/~gitbook/mcp).

# Files

APIs for adding file attachments to accounts

## Get an account's files

> Returns the files uploaded to an account, newest first, by account ID or external ID.\
> \
> \*\*Rate limit:\*\* 300 requests per minute

```json
{"openapi":"3.0.3","info":{"title":"Pylon API.","version":"1.0.0"},"tags":[],"servers":[{"description":"US region","url":"https://api.usepylon.com"},{"description":"EU region","url":"https://api.eu.usepylon.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"description":"Authorization: Bearer <token>","scheme":"bearer","type":"http"}},"responses":{"GetAccountFilesResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetAccountFilesResponseBody"}}},"description":""},"UnauthorizedApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The request could not be authenticated for this API."},"ForbiddenApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The authenticated caller or organization is not allowed to access this endpoint or operation."},"ErrorApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""},"TooManyRequestsApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The request exceeded the applicable rate limit.","headers":{"Retry-After":{"description":"Seconds until the next request to this endpoint is permitted.","schema":{"format":"int64","type":"integer"}},"X-Retry-After":{"description":"Seconds until the full per-minute allowance is restored. Capacity returns gradually before then.","schema":{"format":"int64","type":"integer"}}}},"InternalServerErrorApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"An unexpected internal error occurred."}},"schemas":{"GetAccountFilesResponseBody":{"properties":{"data":{"description":"The data payload of the response.","items":{"$ref":"#/components/schemas/AccountFile"},"type":"array"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"required":["data","request_id"],"type":"object"},"AccountFile":{"properties":{"created_at":{"description":"When the file was uploaded, in RFC 3339 format.","format":"date-time","type":"string"},"file_type":{"description":"The file's MIME type.","type":"string"},"id":{"description":"The ID of the file.","type":"string"},"name":{"description":"The file name.","type":"string"},"updated_at":{"description":"When the file was last replaced or renamed, in RFC 3339 format.","format":"date-time","type":"string"},"url":{"description":"The URL to download the file from.","type":"string"}},"required":["created_at","file_type","id","name","updated_at","url"],"type":"object"},"ErrorApiResponseBody":{"properties":{"code":{"description":"A stable machine-readable identifier for this failure, safe to branch on\ninstead of the message text. Omitted when the failure has no assigned code.\n\nKnown values: `recipients_suppressed`, `email_bounced`, `internal_issue_reply_not_allowed`, `duplicate_object`, `invalid_authorization_header`, `invalid_api_token`, `invalid_oauth_token`, `wrong_region_token`, `organization_deactivated`, `organization_suspended`, `permission_denied`, `oauth_not_permitted`, `rate_limited`, `not_found`, `method_not_allowed`, `payload_too_large`, `invalid_request_body`, `internal_error`, `invalid_webhook_credentials`, `organization_inactive`, `invalid_filter`, `invalid_user_id`. This list is not exhaustive.","type":"string"},"errors":{"description":"The list of errors.","items":{"type":"string"},"type":"array"},"exists_id":{"description":"The ID of the object that already exists if this is a duplicate object error.","type":"string"},"filter_errors":{"description":"One entry per problem found in the request's filter. Present only when code is\n\"invalid_filter\"; errors carries the same messages as plain text.","items":{"$ref":"#/components/schemas/FilterError"},"type":"array"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"required":["request_id"],"type":"object"},"FilterError":{"properties":{"allowed":{"description":"What is accepted in place of the rejected field, operator, value, or relationship.\nLong lists are cut off after 100 entries.","items":{"type":"string"},"type":"array"},"code":{"description":"A stable machine-readable identifier for this problem.\n\nKnown values: `invalid_shape`, `too_deep`, `unknown_operator`, `unknown_field`, `operator_not_allowed`, `missing_value`, `unexpected_value`, `invalid_value`, `unknown_relationship`, `unsupported`. This list is not exhaustive.","type":"string"},"field":{"description":"The field of the filter at path, when it has one.","type":"string"},"message":{"description":"What is wrong and how to fix it.","type":"string"},"operator":{"description":"The operator of the filter at path, when it has one.","type":"string"},"path":{"description":"Where the problem is, as a JSONPath from the root of the filter, such as\n\"$.subfilters[1].related_object.filter\".","type":"string"},"suggestion":{"description":"The accepted entry closest to the rejected one, when one is close enough.","type":"string"}},"required":["code","message","path"],"type":"object"}}},"paths":{"/accounts/{id}/files":{"get":{"description":"Returns the files uploaded to an account, newest first, by account ID or external ID.\n\n**Rate limit:** 300 requests per minute","operationId":"GetAccountFiles","parameters":[{"description":"The ID or external ID of the account.","in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"$ref":"#/components/responses/GetAccountFilesResponse"},"401":{"$ref":"#/components/responses/UnauthorizedApiResponse"},"403":{"$ref":"#/components/responses/ForbiddenApiResponse"},"404":{"$ref":"#/components/responses/ErrorApiResponse"},"429":{"$ref":"#/components/responses/TooManyRequestsApiResponse"},"500":{"$ref":"#/components/responses/InternalServerErrorApiResponse"}},"summary":"Get an account's files","tags":["accounts"]}}}}
```

## Upload files to an account

> Uploads one or more files to an account by ID or external ID.\
> \
> \*\*Rate limit:\*\* 30 requests per minute

```json
{"openapi":"3.0.3","info":{"title":"Pylon API.","version":"1.0.0"},"tags":[],"servers":[{"description":"US region","url":"https://api.usepylon.com"},{"description":"EU region","url":"https://api.eu.usepylon.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"description":"Authorization: Bearer <token>","scheme":"bearer","type":"http"}},"responses":{"UploadAccountFileResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UploadAccountFileResponseBody"}}},"description":""},"BadRequestApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The request was invalid or could not be completed."},"UnauthorizedApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The request could not be authenticated for this API."},"ForbiddenApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The authenticated caller or organization is not allowed to access this endpoint or operation."},"ErrorApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""},"TooManyRequestsApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The request exceeded the applicable rate limit.","headers":{"Retry-After":{"description":"Seconds until the next request to this endpoint is permitted.","schema":{"format":"int64","type":"integer"}},"X-Retry-After":{"description":"Seconds until the full per-minute allowance is restored. Capacity returns gradually before then.","schema":{"format":"int64","type":"integer"}}}},"InternalServerErrorApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"An unexpected internal error occurred."}},"schemas":{"UploadAccountFileResponseBody":{"properties":{"data":{"description":"The data payload of the response.","items":{"$ref":"#/components/schemas/Attachment"},"type":"array"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"required":["data","request_id"],"type":"object"},"Attachment":{"properties":{"description":{"description":"The description of the attachment.","type":"string"},"id":{"description":"The ID of the attachment.","type":"string"},"name":{"description":"The name of the attachment.","type":"string"},"url":{"description":"The URL of the attachment.","type":"string"}},"required":["description","id","name","url"],"type":"object"},"ErrorApiResponseBody":{"properties":{"code":{"description":"A stable machine-readable identifier for this failure, safe to branch on\ninstead of the message text. Omitted when the failure has no assigned code.\n\nKnown values: `recipients_suppressed`, `email_bounced`, `internal_issue_reply_not_allowed`, `duplicate_object`, `invalid_authorization_header`, `invalid_api_token`, `invalid_oauth_token`, `wrong_region_token`, `organization_deactivated`, `organization_suspended`, `permission_denied`, `oauth_not_permitted`, `rate_limited`, `not_found`, `method_not_allowed`, `payload_too_large`, `invalid_request_body`, `internal_error`, `invalid_webhook_credentials`, `organization_inactive`, `invalid_filter`, `invalid_user_id`. This list is not exhaustive.","type":"string"},"errors":{"description":"The list of errors.","items":{"type":"string"},"type":"array"},"exists_id":{"description":"The ID of the object that already exists if this is a duplicate object error.","type":"string"},"filter_errors":{"description":"One entry per problem found in the request's filter. Present only when code is\n\"invalid_filter\"; errors carries the same messages as plain text.","items":{"$ref":"#/components/schemas/FilterError"},"type":"array"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"required":["request_id"],"type":"object"},"FilterError":{"properties":{"allowed":{"description":"What is accepted in place of the rejected field, operator, value, or relationship.\nLong lists are cut off after 100 entries.","items":{"type":"string"},"type":"array"},"code":{"description":"A stable machine-readable identifier for this problem.\n\nKnown values: `invalid_shape`, `too_deep`, `unknown_operator`, `unknown_field`, `operator_not_allowed`, `missing_value`, `unexpected_value`, `invalid_value`, `unknown_relationship`, `unsupported`. This list is not exhaustive.","type":"string"},"field":{"description":"The field of the filter at path, when it has one.","type":"string"},"message":{"description":"What is wrong and how to fix it.","type":"string"},"operator":{"description":"The operator of the filter at path, when it has one.","type":"string"},"path":{"description":"Where the problem is, as a JSONPath from the root of the filter, such as\n\"$.subfilters[1].related_object.filter\".","type":"string"},"suggestion":{"description":"The accepted entry closest to the rejected one, when one is close enough.","type":"string"}},"required":["code","message","path"],"type":"object"}}},"paths":{"/accounts/{id}/files":{"post":{"description":"Uploads one or more files to an account by ID or external ID.\n\n**Rate limit:** 30 requests per minute","operationId":"UploadAccountFile","parameters":[{"description":"The ID or external ID of the account to upload files to.","in":"path","name":"id","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"multipart/form-data":{"schema":{"properties":{"file":{"description":"The file to upload.","format":"binary","type":"string"},"file_url":{"description":"The URL to fetch the file from, if the file is not provided.","type":"string"}},"type":"object"}}}},"responses":{"200":{"$ref":"#/components/responses/UploadAccountFileResponse"},"400":{"$ref":"#/components/responses/BadRequestApiResponse"},"401":{"$ref":"#/components/responses/UnauthorizedApiResponse"},"403":{"$ref":"#/components/responses/ForbiddenApiResponse"},"404":{"$ref":"#/components/responses/ErrorApiResponse"},"429":{"$ref":"#/components/responses/TooManyRequestsApiResponse"},"500":{"$ref":"#/components/responses/InternalServerErrorApiResponse"}},"summary":"Upload files to an account","tags":["accounts"]}}}}
```


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.usepylon.com/pylon-docs/developer/api/api-reference/accounts/files.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
