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

# Blob Chunked Upload Part

> This documentation provides a comprehensive overview of the PUT /v1/objects/chunked endpoint of the SquareCloud Blob API.

<ParamField header="Authorization" type="string" placeholder="API Key" required>
  The API key for your account. You can find this in your [account settings](https://squarecloud.app/en/account/security).
</ParamField>

Chunked Part sends one chunk of an upload opened with [Chunked Init](/en/blob-reference/endpoint/chunked-init). The body is the **raw bytes** of the chunk, not multipart/form-data. Part numbers run from 1 to `max_parts` (205) and may be sent in **any order**; a failed part can simply be re-sent with the same number, and re-sending is safe because parts are idempotent.

Every chunk except the last must be between **5 MB and 32 MB**; the last one may be smaller. Send at most **6 parts in parallel**: a seventh in-flight part returns `TOO_MANY_CONCURRENT_CHUNKS`, in which case wait for one to finish and retry that part. With 6 parts in flight, 16 MB chunks are a good default for a browser.

This route is exempt from the account-wide API budget (`plan.rate`), so a long upload cannot exhaust your API quota for the rest of the platform. Its own limiter allows 60 parts per 10 seconds, blocked for 10 seconds past that.

<ParamField query="upload" type="string" placeholder="Upload token" required>
  The opaque `upload` token returned by Chunked Init.
</ParamField>

<ParamField query="part" type="number" placeholder="1..205" required>
  The part number, from 1 to 205. Parts may be sent in any order.
</ParamField>

<ParamField body="body" type="binary" required>
  The raw chunk bytes (`Content-Type: application/octet-stream`). **Not** multipart/form-data.
</ParamField>

### Response

<ResponseField name="status" type="string">
  Indicates whether the call was successful. "success" if successful, "error" if not.
</ResponseField>

<ResponseField name="response" type="object">
  <Expandable title="Toggle object">
    <ResponseField name="part" type="number">
      The part number that was stored.
    </ResponseField>

    <ResponseField name="size" type="number">
      The size of the stored chunk, in bytes.
    </ResponseField>

    <ResponseField name="etag" type="string">
      The storage ETag of the part. Informational only: completion reads the part list back from storage, so you never send it back.
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl --request PUT \
    --url 'https://blob.squarecloud.app/v1/objects/chunked?upload=UPLOAD_TOKEN&part=1' \
    --header 'Authorization: YOUR_API_KEY' \
    --header 'Content-Type: application/octet-stream' \
    --data-binary '@./chunk-1.bin'
  ```

  ```javascript JavaScript theme={null}
  const chunk = file.slice(0, 16 * 1024 * 1024); // first 16 MB

  const params = new URLSearchParams({ upload: uploadToken, part: '1' });

  const response = await fetch(`https://blob.squarecloud.app/v1/objects/chunked?${params}`, {
    method: 'PUT',
    headers: {
      Authorization: 'YOUR_API_KEY',
      'Content-Type': 'application/octet-stream',
    },
    body: chunk,
  });
  ```

  ```python Python theme={null}
  import requests

  with open('./bigfile.bin', 'rb') as f:
      chunk = f.read(16 * 1024 * 1024)

  response = requests.put(
      'https://blob.squarecloud.app/v1/objects/chunked',
      headers={'Authorization': 'YOUR_API_KEY', 'Content-Type': 'application/octet-stream'},
      params={'upload': upload_token, 'part': 1},
      data=chunk,
  )
  ```
</RequestExample>

<ResponseExample>
  ```json theme={null}
  {
    "status": "success",
    "response": {
      "part": 1,
      "size": 16777216,
      "etag": "\"9bb58f26192e4ba00f01e2e7b136bbd8\""
    }
  }
  ```
</ResponseExample>

### Troubleshooting

<Tabs>
  <Tab title="400 Status Code">
    ### Chunk-Related

    <CodeGroup>
      ```json INVALID_UPLOAD_TOKEN theme={null}
      // The upload token is missing, malformed, or does not belong to your account.
      {
          "status": "error",
          "code": "INVALID_UPLOAD_TOKEN"
      }
      ```

      ```json INVALID_CHUNK_PART theme={null}
      // The part number must be an integer between 1 and 205.
      {
          "status": "error",
          "code": "INVALID_CHUNK_PART"
      }
      ```

      ```json EMPTY_CHUNK theme={null}
      // The chunk body was empty.
      {
          "status": "error",
          "code": "EMPTY_CHUNK"
      }
      ```
    </CodeGroup>
  </Tab>

  <Tab title="401 Status Code">
    ### Unauthorized

    <CodeGroup>
      ```json ACCESS_DENIED theme={null}
      // The API key is missing or invalid. Set a valid key in the Authorization header.
      {
          "status": "error",
          "code": "ACCESS_DENIED"
      }
      ```

      ```json PERMISSION_DENIED theme={null}
      // The account has no active paid plan. Uploading to Blob Storage requires a paid plan.
      {
          "status": "error",
          "code": "PERMISSION_DENIED"
      }
      ```
    </CodeGroup>
  </Tab>

  <Tab title="404 Status Code">
    ### Not Found

    <CodeGroup>
      ```json UPLOAD_NOT_FOUND theme={null}
      // The upload was already completed, aborted, or expired.
      {
          "status": "error",
          "code": "UPLOAD_NOT_FOUND"
      }
      ```
    </CodeGroup>
  </Tab>

  <Tab title="413 Status Code">
    ### Payload too large

    <CodeGroup>
      ```json CHUNK_TOO_LARGE theme={null}
      // Each chunk accepts up to 32 MB.
      {
          "status": "error",
          "code": "CHUNK_TOO_LARGE"
      }
      ```
    </CodeGroup>
  </Tab>

  <Tab title="429 Status Code">
    ### Rate limited

    <CodeGroup>
      ```json RATE_LIMITED theme={null}
      // Part rate limit reached (60 parts per 10s window, blocked for 10s).
      {
          "status": "error",
          "code": "RATE_LIMITED"
      }
      ```

      ```json TOO_MANY_CONCURRENT_CHUNKS theme={null}
      // At most 6 chunks may be in flight at a time. Wait for one to finish, then retry this part.
      {
          "status": "error",
          "code": "TOO_MANY_CONCURRENT_CHUNKS"
      }
      ```
    </CodeGroup>
  </Tab>

  <Tab title="500 Status Code">
    ### Upload failed

    <CodeGroup>
      ```json UPLOAD_FAILED theme={null}
      // Failed to upload the chunk. Retry this part.
      {
          "status": "error",
          "code": "UPLOAD_FAILED"
      }
      ```
    </CodeGroup>
  </Tab>
</Tabs>
