---
title: Upload documents to a profile
slug: andrei/upload-documents-to-a-profile
createdAt: 2026-10-05T10:36:01.732Z
---

{
  "id": "7K7jKylXPi8LKueOjYHId",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://api.detected.app/api/v2/public/profiles/{uuid}/documents/{libraryId}",
    "servers": [
      {
        "url": "https://api.detected.app/api/v2/public/profiles/{uuid}/documents/{libraryId}",
        "description": "Production"
      }
    ],
    "name": "Upload documents to a profile",
    "description": "<p>Uploads one or more documents to a profile, into the document library given by <code>libraryId</code>. Send the files as <code>multipart/form-data</code>, with each file under a key of the form <code>document_1</code>, <code>document_2</code> and so on. The response lists the uploaded documents.</p>",
    "contentType": "multipart/form-data",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "uuid",
          "type": "string",
          "description": "<p>UUID of the item named in the path, for example the profile in <code>/profiles/{uuid}</code> or the representative in <code>/representatives/{uuid}</code>.</p>"
        },
        {
          "kind": "required",
          "name": "libraryId",
          "type": "integer",
          "description": "<p>ID of the document library to upload the documents to. Use <code>GET /documents/libraries</code> to list the libraries.</p>"
        }
      ],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "application/json"
          ],
          "default": "application/json"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [],
      "formDataParameters": [
        {
          "name": "documents",
          "kind": "required",
          "type": "map",
          "description": "<p>Keyed files: document_1, document_2, ...</p>",
          "example": "",
          "customType": "map<string, BinaryFile>",
          "schema": []
        }
      ],
      "oAuthParameters": [
        {
          "id": "AccessToken",
          "name": "AccessToken",
          "kind": "optional",
          "type": "http",
          "description": "<p>The API uses OAuth 2.0. Request an access token from <code>POST /oauth/token</code> with the client ID and client secret of your integration client, and your account slug. Send the access token in the <code>Authorization</code> header of every request, in the format <code>Authorization: Bearer &#x3C;access_token></code>. The access token carries the scopes set on your integration client in the dashboard. Access tokens expire. When one expires, request a new one.</p>",
          "scheme": "bearer"
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "<p>OK. The documents were uploaded, and the response lists them.</p>",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "array",
            "description": "",
            "customType": "DocumentViewResponse[]",
            "schema": [
              {
                "name": "id",
                "kind": "required",
                "type": "number",
                "description": "Document ID."
              },
              {
                "name": "profile_id",
                "kind": "required",
                "type": "string",
                "description": "UUID of the profile the document belongs to."
              },
              {
                "name": "document_id",
                "kind": "required",
                "type": "string",
                "description": "ID of the document type."
              },
              {
                "name": "category",
                "kind": "required",
                "type": "string",
                "description": "Category of the document."
              },
              {
                "name": "name",
                "kind": "required",
                "type": "string",
                "description": "Name of the document."
              },
              {
                "name": "link",
                "kind": "required",
                "type": "string",
                "description": "<p>Temporary URL to download the document. It stops working at the time given in <code>link_expires_at</code>.</p>"
              },
              {
                "name": "file_type",
                "kind": "required",
                "type": "string",
                "description": "File type of the document."
              },
              {
                "name": "link_expires_at",
                "kind": "required",
                "type": "string",
                "description": "<p>Date and time at which <code>link</code> expires.</p>"
              },
              {
                "name": "fraud_check",
                "kind": "optional",
                "type": "object",
                "description": "Results of the AI fraud analysis of the document.",
                "example": "",
                "schema": [
                  {
                    "name": "processed_at",
                    "kind": "optional",
                    "type": "string",
                    "description": "Date and time the fraud analysis was processed."
                  },
                  {
                    "name": "analysis",
                    "kind": "optional",
                    "type": "object",
                    "description": "Details of the fraud analysis.",
                    "example": "",
                    "schema": [
                      {
                        "name": "score",
                        "kind": "optional",
                        "type": "string",
                        "description": "<p>Fraud risk category of the document, for example <code>low</code>.</p>"
                      },
                      {
                        "name": "document_type",
                        "kind": "optional",
                        "type": "string",
                        "description": "<p>Type of document identified, in plain language.</p>"
                      },
                      {
                        "name": "meta_data",
                        "kind": "optional",
                        "type": "object",
                        "description": "Metadata embedded in the document.",
                        "example": "",
                        "schema": [
                          {
                            "name": "producer",
                            "kind": "optional",
                            "type": "string",
                            "description": "<p>Software that produced the file, from its metadata.</p>"
                          },
                          {
                            "name": "creator",
                            "kind": "optional",
                            "type": "string",
                            "description": "<p>Software that created the original document, from its metadata.</p>"
                          },
                          {
                            "name": "creation_date",
                            "kind": "optional",
                            "type": "string",
                            "description": "<p>Date the document was created, from its metadata.</p>"
                          },
                          {
                            "name": "mod_date",
                            "kind": "optional",
                            "type": "string",
                            "description": "<p>Date the document was last modified, from its metadata.</p>"
                          },
                          {
                            "name": "author",
                            "kind": "optional",
                            "type": "string",
                            "description": "<p>Author of the document, from its metadata.</p>"
                          },
                          {
                            "name": "keywords",
                            "kind": "optional",
                            "type": "string",
                            "description": "<p>Keywords in the document metadata, separated by commas.</p>"
                          },
                          {
                            "name": "subject",
                            "kind": "optional",
                            "type": "string",
                            "description": "<p>Subject of the document, from its metadata.</p>"
                          },
                          {
                            "name": "title",
                            "kind": "optional",
                            "type": "string",
                            "description": "<p>Title of the document, from its metadata.</p>"
                          }
                        ]
                      },
                      {
                        "name": "indicators",
                        "kind": "optional",
                        "type": "array",
                        "description": "Fraud indicators detected in the document.",
                        "example": "",
                        "itemType": "object",
                        "customType": "object[]",
                        "schema": [
                          {
                            "name": "type",
                            "kind": "optional",
                            "type": "string",
                            "description": "<p>Type of fraud indicator, for example <code>anomaly</code>.</p>"
                          },
                          {
                            "name": "category",
                            "kind": "optional",
                            "type": "string",
                            "description": "<p>Category of the fraud indicator, for example <code>image_manipulation</code>.</p>"
                          },
                          {
                            "name": "title",
                            "kind": "optional",
                            "type": "string",
                            "description": "Short title of the fraud indicator."
                          },
                          {
                            "name": "description",
                            "kind": "optional",
                            "type": "string",
                            "description": "Explanation of what was detected."
                          }
                        ]
                      }
                    ]
                  }
                ]
              },
              {
                "name": "translation",
                "kind": "optional",
                "type": "object",
                "description": "Translation of the document.",
                "example": "",
                "schema": [
                  {
                    "name": "status",
                    "kind": "optional",
                    "type": "string",
                    "description": "Status of the translation."
                  },
                  {
                    "name": "link",
                    "kind": "optional",
                    "type": "string",
                    "description": "<p>Temporary URL to download the translated document. It stops working at the time given in <code>link_expires_at</code>.</p>"
                  },
                  {
                    "name": "file_type",
                    "kind": "optional",
                    "type": "string",
                    "description": "File type of the translated document."
                  },
                  {
                    "name": "link_expires_at",
                    "kind": "optional",
                    "type": "string",
                    "description": "<p>Date and time at which <code>link</code> expires.</p>"
                  },
                  {
                    "name": "extracted",
                    "kind": "optional",
                    "type": "string",
                    "description": "Translated text of the document."
                  }
                ]
              },
              {
                "name": "ocr",
                "kind": "optional",
                "type": "object",
                "description": "Text extracted from the original document using OCR.",
                "example": "",
                "schema": [
                  {
                    "name": "extracted",
                    "kind": "optional",
                    "type": "string",
                    "description": "Text extracted from the document."
                  }
                ]
              },
              {
                "name": "updated_at",
                "kind": "required",
                "type": "string",
                "description": "Date and time the document was last updated."
              },
              {
                "name": "created_at",
                "kind": "required",
                "type": "string",
                "description": "Date and time the document was created."
              }
            ],
            "modelRef": "#/components/schemas/DocumentViewResponse",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "<p>Bad Request. The request could not be processed because it is invalid. The <code>message</code> field explains why.</p>",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "schema": [
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": "<p>A human-readable description of the error.</p>"
              }
            ],
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "401",
        "description": "<p>Unauthorized. The access token is missing, invalid or has expired.</p>",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "schema": [
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": "<p>A human-readable description of the error.</p>"
              }
            ],
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "422",
        "description": "Unprocessable Content. The request was understood but failed validation. The response lists the fields that failed and why.",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "schema": [
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": "<p>A human-readable description of the error.</p>"
              },
              {
                "name": "example_field",
                "kind": "optional",
                "type": "array",
                "description": "<p>Validation errors for one field of the request body. The property name is the name of the field that failed validation (<code>example_field</code> is a placeholder).</p>",
                "example": "",
                "itemType": "string",
                "customType": "string[]",
                "itemExample": "",
                "itemDefault": ""
              }
            ],
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "429",
        "description": "<p>Too Many Requests. You have exceeded the rate limit. Wait for the number of seconds given in the <code>Retry-After</code> header before trying again.</p>",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "schema": [
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": "<p>A human-readable description of the error.</p>"
              }
            ],
            "isExpanded": true
          }
        ]
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "example-0-curl",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.detected.app/api/v2/public/profiles/{uuid}/documents/{libraryId} \\\n     --header 'accept: application/json' \\\n     --header 'content-type: multipart/form-data' \\\n     --form 'documents=\"map\"'"
        },
        {
          "id": "example-1-javascript",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"multipart/form-data\");\n\nvar formdata = new FormData();\nformdata.append(\"documents\", \"map\");\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: formdata,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.detected.app/api/v2/public/profiles/{uuid}/documents/{libraryId}\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "example-2-ruby",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.detected.app/api/v2/public/profiles/{uuid}/documents/{libraryId}\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"multipart/form-data\"\nform_data = [['documents', File.open('undefined')]]\nrequest.set_form form_data, 'multipart/form-data'\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "example-3-python",
          "language": "python",
          "label": "Python",
          "code": "import requests\n\nurl = \"https://api.detected.app/api/v2/public/profiles/{uuid}/documents/{libraryId}\"\n\npayload = {}\nfiles=[\n\n]\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'multipart/form-data'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload, files=files)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "example-0-curl"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// OK. The documents were uploaded, and the response lists them.\n[\n  {\n    \"id\": 0,\n    \"profile_id\": \"\",\n    \"document_id\": \"\",\n    \"category\": \"\",\n    \"name\": \"\",\n    \"link\": \"\",\n    \"file_type\": \"\",\n    \"link_expires_at\": \"\",\n    \"fraud_check\": {\n      \"processed_at\": \"\",\n      \"analysis\": {\n        \"score\": \"\",\n        \"document_type\": \"\",\n        \"meta_data\": {\n          \"producer\": \"\",\n          \"creator\": \"\",\n          \"creation_date\": \"\",\n          \"mod_date\": \"\",\n          \"author\": \"\",\n          \"keywords\": \"\",\n          \"subject\": \"\",\n          \"title\": \"\"\n        },\n        \"indicators\": [\n          {\n            \"type\": \"\",\n            \"category\": \"\",\n            \"title\": \"\",\n            \"description\": \"\"\n          }\n        ]\n      }\n    },\n    \"translation\": {\n      \"status\": \"\",\n      \"link\": \"\",\n      \"file_type\": \"\",\n      \"link_expires_at\": \"\",\n      \"extracted\": \"\"\n    },\n    \"ocr\": {\n      \"extracted\": \"\"\n    },\n    \"updated_at\": \"\",\n    \"created_at\": \"\"\n  }\n]"
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// Bad Request. The request could not be processed because it is invalid. The message field explains why.\n{\n  \"message\": \"\"\n}"
        },
        {
          "id": "response-2-401",
          "language": "401",
          "code": "// Unauthorized. The access token is missing, invalid or has expired.\n{\n  \"message\": \"\"\n}"
        },
        {
          "id": "response-3-422",
          "language": "422",
          "code": "// Unprocessable Content. The request was understood but failed validation. The response lists the fields that failed and why.\n{\n  \"message\": \"\",\n  \"example_field\": [\n    \"\"\n  ]\n}"
        },
        {
          "id": "response-4-429",
          "language": "429",
          "code": "// Too Many Requests. You have exceeded the rate limit. Wait for the number of seconds given in the Retry-After header before trying again.\n{\n  \"message\": \"\"\n}"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}