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

# Upload/Update File

> Upload/update the content of file fields.

#### Recipes

<AccordionGroup>
  <Accordion title="Upload/update file with API key">
    <Steps>
      <Step title="1. Use 'Authorization' header to pass API key">
        ```curl {2} theme={null}
        curl -X POST \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -F "field_name=avatar" \
        -F 'file=@"my_avatar.jpg"' \
        https://api.quickblox.com/data/UserProfileClass/5d863a78a0eb474dae6099c6/file.json
        ```
      </Step>

      <Step title="2. As a result, the file is uploaded and the API returns its metadata.">
        ```json theme={null}
        {
          "file_id": "5d863c18a28f9a3a551cb557",
          "size": 2004727,
          "name": "Image.jpg",
          "content_type": "image/jpeg"
        }
        ```
      </Step>
    </Steps>
  </Accordion>
</AccordionGroup>

#### Path Parameters

<ParamField path="class_name" type="string" required>
  Custom object class name.
</ParamField>

<ParamField path="custom_object_record_id" type="string" required>
  ID of the custom object record. Generated automatically by the server after record creation.
</ParamField>

#### Body Parameters

<ParamField body="field_name" type="string" required>
  Custom object record field which contains a file.
</ParamField>

<ParamField body="file" type="file" required>
  File for uploading. The max file size is 32 MB.
</ParamField>

#### Headers

<ParamField header="QB-Token" type="string" required> A user or application session token. See [Authentication](/reference/authentication) page to learn more about session tokens. Must be used either QB-Token or Authorization. </ParamField>

<ParamField header="Authorization" type="string" default="ApiKey {your_api_key}">
  API key from Dashboard. Expected format: `ApiKey {your_api_key}`. Must be used
  either QB-Token or Authorization.
</ParamField>

<ParamField header="On-Behalf-Of" type="string">
  User ID. The user ID of the user on whose behalf the request is being made.
</ParamField>

#### Responses

<AccordionGroup>
  <Accordion title="200">
    A successful response

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

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

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

    <ResponseField name="content_type" type="string" />
  </Accordion>

  <Accordion title="403">
    An error response

    <ResponseField name="errors" type="array of strings" />
  </Accordion>

  <Accordion title="404">
    An error response

    <ResponseField name="errors" type="array of strings" />
  </Accordion>
</AccordionGroup>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST \
  -H "QB-Token: a04ed6adfdb98cde99837088830349f67d012bba" \
  -F "field_name=avatar" \
  -F 'file=@"my_avatar.jpg"' \
  https://api.quickblox.com/data/UserProfileClass/5d863a78a0eb474dae6099c6/file.json
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "file_id": "5d863c18a28f9a3a551cb557",
    "size": 2004727,
    "name": "Image.jpg",
    "content_type": "image/jpeg"
  }
  ```

  ```json 403 theme={null}
  {
    "errors": [
      "Undefined class"
    ]
  }
  ```

  ```json 404 theme={null}
  {
    "errors": [
      "Wrong arguments"
    ]
  }
  ```
</ResponseExample>
