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

# Upload files to custom fields

> Post the necessary fields for the API to upload files. The files need to be a buffer with the key "< custom_field_id >_< file_id >". <br /> Here custom field id is the ID of your custom field and file

Post the necessary fields for the API to upload files. The files need to be a buffer with the key "\< custom\_field\_id >\_\< file\_id >". \<br /> Here custom field id is the ID of your custom field and file id is a randomly generated id (or uuid) \<br /> There is support for multiple file uploads as well. Have multiple fields in the format mentioned.\<br />File size is limited to 50 MB.\<br />\<br /> The allowed file types are: \<br/> \<ul>\<li>PDF\</li>\<li>DOCX\</li>\<li>DOC\</li>\<li>JPG\</li>\<li>JPEG\</li>\<li>PNG\</li>\<li>GIF\</li>\<li>CSV\</li>\<li>XLSX\</li>\<li>XLS\</li>\<li>MP4\</li>\<li>MPEG\</li>\<li>ZIP\</li>\<li>RAR\</li>\<li>TXT\</li>\<li>SVG\</li>\</ul> \<br />\<br /> The API will return the updated contact object.

```http theme={null}
POST https://services.leadconnectorhq.com/forms/upload-custom-files
```

## Autorización

<ParamField header="Authorization" type="string" required>
  Bearer token generado desde el portal Leadway. Ver [Autenticación](/authentication).
</ParamField>

<ParamField header="Version" type="string" required default="2021-07-28">
  Versión de la API.
</ParamField>

## Query parameters

<ParamField query="contactId" type="string" required default="dtEv6KtI27yF92YPm3Zz">
  Contact ID to upload the file to.
</ParamField>

<ParamField query="locationId" type="string" required default="quXmPY59n1zgGBabY1bZ">
  Account ID of the contact.
</ParamField>

## Respuestas

<Accordion title="200 - Successful response" />

<Accordion title="400 - Bad Request">
  ```json theme={null}
  {}
  ```
</Accordion>

<Accordion title="401 - Unauthorized">
  ```json theme={null}
  {}
  ```
</Accordion>

## Ejemplo

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST 'https://services.leadconnectorhq.com/forms/upload-custom-files' \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -H 'Version: 2021-07-28'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://services.leadconnectorhq.com/forms/upload-custom-files', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
      Version: '2021-07-28',
    },
  });
  const data = await response.json();
  ```

  ```python Python theme={null}
  import os, requests
  response = requests.request(
      'POST',
      'https://services.leadconnectorhq.com/forms/upload-custom-files',
      headers={
          'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
          'Version': '2021-07-28',
      },
  )
  data = response.json()
  ```

  ```php PHP theme={null}
  <?php
  $ch = curl_init('https://services.leadconnectorhq.com/forms/upload-custom-files');
  curl_setopt_array($ch, [
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_CUSTOMREQUEST => 'POST',
      CURLOPT_HTTPHEADER => [
          'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
          'Version: 2021-07-28',
      ],
  ]);
  $data = json_decode(curl_exec($ch), true);
  ```
</CodeGroup>
