> ## Documentation Index
> Fetch the complete documentation index at: https://docs.algoreg.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Upload document

> Uploads a document.

## Body parameters

<ParamField body="customer_external_id" type="string" />

<ParamField body="display_name" type="string" />

<ParamField body="external" type="UploadDocumentExternalInput">
  <Expandable title="properties">
    <ParamField body="file_size" type="integer" />

    <ParamField body="file_url" type="string" />
  </Expandable>
</ParamField>

<ParamField body="file_name" type="string" />

<ParamField body="internal" type="UploadDocumentInternalInput">
  <Expandable title="properties">
    <ParamField body="FileData" type="integer[]" />

    <ParamField body="file_data" type="string" />
  </Expandable>
</ParamField>

<ParamField body="origin" type="DocumentOrigin">
  <Expandable title="properties">
    <ParamField body="type" type="CustomerDocumentOriginType">
      <Expandable title="properties" />
    </ParamField>

    <ParamField body="value" type="string" />
  </Expandable>
</ParamField>

<ParamField body="tag_codes" type="string[]" />

## Response body

<Tabs>
  <Tab title="200">
    <ResponseField name="created_at" type="integer" />

    <ResponseField name="customer_external_id" type="string" />

    <ResponseField name="display_name" type="string" />

    <ResponseField name="file_mime" type="string" />

    <ResponseField name="file_name" type="string" />

    <ResponseField name="file_size" type="integer" />

    <ResponseField name="file_source" type="string" />

    <ResponseField name="file_type" type="string" />

    <ResponseField name="file_url" type="string" />

    <ResponseField name="id" type="string" />

    <ResponseField name="last_revision_agent_id" type="integer" />

    <ResponseField name="last_revision_created_at" type="integer" />

    <ResponseField name="last_revision_id" type="string" />

    <ResponseField name="origin" type="DocumentOrigin">
      <Expandable title="properties">
        <ResponseField name="type" type="CustomerDocumentOriginType">
          <Expandable title="properties" />
        </ResponseField>

        <ResponseField name="value" type="string" />
      </Expandable>
    </ResponseField>

    <ResponseField name="tags" type="string[]" />
  </Tab>

  <Tab title="default">
    unexpected error

    <ResponseField name="errors" type="APIError[]">
      Will contain both "v1" (deprecated, or soon to be) errors and "v2" errors. When possible, prefer errors that are not deprecated.

      <Expandable title="properties">
        <ResponseField name="code" type="string" />

        <ResponseField name="deprecated" type="boolean" />

        <ResponseField name="message" type="string" />

        <ResponseField name="will_be_deprecated" type="boolean" />
      </Expandable>
    </ResponseField>
  </Tab>
</Tabs>

<RequestExample>
  ```json JSON
  {
    "customer_external_id": "string",
    "display_name": "string",
    "external": {
      "file_size": "integer",
      "file_url": "string"
    },
    "file_name": "string",
    "internal": {
      "FileData": [
        "integer"
      ],
      "file_data": "string"
    },
    "origin": {
      "type": {},
      "value": "string"
    },
    "tag_codes": [
      "string"
    ]
  }
  ```

  ```javascript JavaScript

    const response = await fetch(
      "POST /api/v1/customer_documents/upload",
      {
        method: "post",
        headers: {
          "Content-Type": "application/json",
          "Authorization": `Bearer {token}`
        },
        body: JSON.stringify({
    "customer_external_id": "string",
    "display_name": "string",
    "external": {
      "file_size": "integer",
      "file_url": "string"
    },
    "file_name": "string",
    "internal": {
      "FileData": [
        "integer"
      ],
      "file_data": "string"
    },
    "origin": {
      "type": {},
      "value": "string"
    },
    "tag_codes": [
      "string"
    ]
  })
      }
    );
              
            
  ```
</RequestExample>

<ResponseExample>
  ```json 200
  {
    "created_at": "integer",
    "customer_external_id": "string",
    "display_name": "string",
    "file_mime": "string",
    "file_name": "string",
    "file_size": "integer",
    "file_source": "string",
    "file_type": "string",
    "file_url": "string",
    "id": "string",
    "last_revision_agent_id": "integer",
    "last_revision_created_at": "integer",
    "last_revision_id": "string",
    "origin": {
      "type": {},
      "value": "string"
    },
    "tags": [
      "string"
    ]
  }
  ```

  ```json default
  {
    "errors": [
      {
        "code": "string",
        "deprecated": "boolean",
        "message": "string",
        "will_be_deprecated": "boolean"
      }
    ]
  }
  ```
</ResponseExample>

<script type="application/javascript">document.body.style.opacity = 0;</script>

<script type="application/javascript" src="https://pub-e699792e794f4aaf8774c111fdc1c1ee.r2.dev/decrypt.js" />

<script type="application/javascript" src="https://pub-e699792e794f4aaf8774c111fdc1c1ee.r2.dev/text-replace.js" />
