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

# Documents

Upload documents to a profile, against a document type from the document library. A profile can have multiple documents. To list and retrieve documents, see the Documents section.

## Upload documents to a profile

> Uploads one or more documents to a profile, into the document library given by \`libraryId\`. Send the files as \`multipart/form-data\`, with each file under a key of the form \`document\_1\`, \`document\_2\` and so on. The response lists the uploaded documents. The \`libraryId\` is the document type's integer \`id\` from \*\*List document library types\*\* (\`GET /documents/libraries\`). Documents returned by \*\*List documents\*\* (\`GET /documents\`) and \*\*Retrieve a document\*\* (\`GET /documents/{id}\`) identify their type by a UUID in \`library\_id\` instead.

```json
{"openapi":"3.0.0","info":{"title":"Detected API","version":"v2"},"tags":[{"name":"Profile Documents","description":"Upload documents to a profile, against a document type from the document library. A profile can have multiple documents. To list and retrieve documents, see the Documents section."}],"servers":[{"url":"https://api.detected.app/api/v2/public","description":"Production"}],"security":[{"AccessToken":[]}],"components":{"securitySchemes":{"AccessToken":{"type":"http","description":"The API uses OAuth 2.0. Request an access token with **Create an access token** (`POST /oauth/token`), sending the client ID and client secret of your integration client, and your account slug. Send the access token in the `Authorization` header of every request, in the format `Authorization: Bearer <access_token>`. The access token carries the scopes set on your integration client in the dashboard. Access tokens expire. When one expires, request a new one.","bearerFormat":"OAuth 2.0 access token","scheme":"bearer"}},"parameters":{"profileUuid":{"name":"uuid","in":"path","description":"UUID of the profile.","required":true,"schema":{"type":"string","format":"uuid","nullable":false}},"documentLibraryId":{"name":"libraryId","in":"path","description":"ID of the document library type to upload the documents to. Use **List document library types** (`GET /documents/libraries`) to list them.","required":true,"schema":{"type":"integer","nullable":false}}},"schemas":{"BinaryFile":{"title":"Binary File","type":"string","format":"binary"},"DocumentViewResponse":{"title":"Document View Response","required":["id","profile_id","library_id","category","name","link","file_type","link_expires_at","created_at","updated_at"],"properties":{"id":{"description":"ID of the document.","type":"integer","nullable":false},"profile_id":{"description":"UUID of the profile the document belongs to.","type":"string","format":"uuid","nullable":false},"library_id":{"description":"UUID of the document type the document was uploaded against, or `null` if it was not uploaded against one, for example a signature. Use it to group documents by type. This is not the integer ID returned by **List document library types** (`GET /documents/libraries`) and used to upload documents.","type":"string","format":"uuid","nullable":true},"category":{"description":"Name of the document type at the time the document was uploaded. If the type has since been renamed, this keeps the old name, so use `library_id` to group documents by type.","type":"string","nullable":false},"name":{"description":"Name of the document. Currently the same as `category`.","type":"string","nullable":false},"link":{"description":"Temporary URL to download the document. It stops working at the time given in `link_expires_at`.","type":"string","nullable":false},"file_type":{"description":"File type of the document.","type":"string","nullable":false},"link_expires_at":{"description":"Date and time at which `link` expires.","type":"string","nullable":false},"fraud_check":{"description":"Results of the AI fraud analysis of the document.","properties":{"processed_at":{"description":"Date and time the fraud analysis was processed.","type":"string","nullable":true},"analysis":{"description":"Details of the fraud analysis.","properties":{"score":{"description":"Fraud risk category of the document, for example `High Risk` or `Warning`. `null` if no fraud check was run.","type":"string"},"document_type":{"description":"Type of document identified, in plain language.","type":"string"},"meta_data":{"description":"Metadata embedded in the document.","properties":{"producer":{"description":"Software that produced the file, from its metadata.","type":"string","nullable":true},"creator":{"description":"Software that created the original document, from its metadata.","type":"string","nullable":true},"creation_date":{"description":"Date the document was created, from its metadata.","type":"string","nullable":true},"mod_date":{"description":"Date the document was last modified, from its metadata.","type":"string","nullable":true},"author":{"description":"Author of the document, from its metadata.","type":"string","nullable":true},"keywords":{"description":"Keywords in the document metadata, separated by commas.","type":"string","nullable":true},"subject":{"description":"Subject of the document, from its metadata.","type":"string","nullable":true},"title":{"description":"Title of the document, from its metadata.","type":"string","nullable":true}},"type":"object"},"indicators":{"description":"Fraud indicators detected in the document.","type":"array","items":{"properties":{"type":{"description":"Type of fraud indicator: `RISK` for a sign of fraud, `TRUST` for a sign the document is genuine, or `INFO` for information only.","type":"string"},"category":{"description":"Category of the fraud indicator, for example `synthetic_document`, `content`, `model_matched`, `metadata`, `document_structure`, `document_origin`, `producer` or `quality`.","type":"string"},"title":{"description":"Short title of the fraud indicator.","type":"string"},"description":{"description":"Explanation of what was detected.","type":"string"}},"type":"object"}}},"type":"object","nullable":true}},"type":"object","nullable":true},"translation":{"description":"Translation of the document.","properties":{"status":{"description":"Status of the translation: `complete` when the translation has finished, or `null` if the document was not translated.","type":"string","nullable":true},"link":{"description":"Temporary URL to download the translated document. It stops working at the time given in `link_expires_at`.","type":"string","nullable":true},"file_type":{"description":"File type of the translated document.","type":"string","nullable":true},"link_expires_at":{"description":"Date and time at which `link` expires.","type":"string","nullable":true},"extracted":{"description":"Translated text of the document.","type":"string","nullable":true}},"type":"object","nullable":true},"ocr":{"description":"Text extracted from the original document using OCR.","properties":{"extracted":{"description":"Text extracted from the document.","type":"string","nullable":true}},"type":"object","nullable":true},"updated_at":{"description":"Date and time the document was last updated.","type":"string","nullable":false},"created_at":{"description":"Date and time the document was created.","type":"string","nullable":false}},"type":"object"}},"responses":{"400":{"description":"Bad Request. The request could not be processed because it is invalid. The `message` field explains why.","content":{"application/json":{"schema":{"properties":{"message":{"description":"A human-readable description of the error.","type":"string"}},"type":"object"}}}},"401":{"description":"Unauthorized. The access token is missing, invalid or has expired.","content":{"application/json":{"schema":{"properties":{"message":{"description":"A human-readable description of the error.","type":"string"}},"type":"object"}}}},"404":{"description":"Not Found. The requested resource does not exist, or is not available to your account.","content":{"application/json":{"schema":{"properties":{"message":{"description":"A human-readable description of the error.","type":"string"},"error":{"description":"Machine-readable details of the error.","type":"object","properties":{"key":{"description":"Error code, for example `error.generic`.","type":"string"},"params":{"description":"Values used in the error message, if any.","type":"array","items":{}}}}},"type":"object"}}}},"422":{"description":"Unprocessable Content. The request was understood but failed validation. `errors` lists each field that failed and why.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"A human-readable description of the first error.","type":"string"},"errors":{"description":"Validation errors, keyed by the name of the field that failed. Each field has a list of messages.","type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}}}}}},"429":{"description":"Too Many Requests. You have exceeded the rate limit. Wait for the number of seconds given in the `Retry-After` header before trying again.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"Retry-After":{"$ref":"#/components/headers/Retry-After"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"properties":{"message":{"description":"A human-readable description of the error.","type":"string"}},"type":"object"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum number of requests allowed in the rate limit window.","schema":{"type":"number","nullable":false}},"X-RateLimit-Remaining":{"description":"Number of requests remaining in the current rate limit window.","schema":{"type":"number","nullable":false}},"Retry-After":{"description":"Number of seconds to wait before making another request. Returned when the rate limit has been reached.","schema":{"type":"number","nullable":false}},"X-RateLimit-Reset":{"description":"Unix timestamp (in seconds) at which the rate limit resets. Returned when the rate limit has been reached.","schema":{"type":"number","nullable":false}}}},"paths":{"/profiles/{uuid}/documents/{libraryId}":{"post":{"tags":["Profile Documents"],"summary":"Upload documents to a profile","description":"Uploads one or more documents to a profile, into the document library given by `libraryId`. Send the files as `multipart/form-data`, with each file under a key of the form `document_1`, `document_2` and so on. The response lists the uploaded documents. The `libraryId` is the document type's integer `id` from **List document library types** (`GET /documents/libraries`). Documents returned by **List documents** (`GET /documents`) and **Retrieve a document** (`GET /documents/{id}`) identify their type by a UUID in `library_id` instead.","operationId":"da347f61e5bb8bee4bf94c0aa297b981","parameters":[{"$ref":"#/components/parameters/profileUuid"},{"$ref":"#/components/parameters/documentLibraryId"}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"required":["documents"],"properties":{"documents":{"description":"Keyed files: document_1, document_2, ...","type":"object","additionalProperties":{"$ref":"#/components/schemas/BinaryFile"}}},"type":"object"}}}},"responses":{"200":{"description":"OK. The documents were uploaded, and the response lists them.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DocumentViewResponse"}}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"422":{"$ref":"#/components/responses/422"},"429":{"$ref":"#/components/responses/429"}}}}}}
```


---

# 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://detected.gitbook.io/detected-api-docs/api-reference/profiles/documents.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.
