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

# Upload a file

> Upload a file with multipart/form-data and receive a reusable fileId. Stores bytes only; does not link the file to any other resource. Use the returned fileId with a separate attach call to put the file to work.

Upload a file with `multipart/form-data` and receive a reusable `fileId`. This endpoint stores bytes only — it does not link the file to a person, a business entity, or a participant document. Use the returned `fileId` with a separate attach call to put the file to work.

This is the only Commenda Partner API endpoint that accepts binary content. Files are scoped to the customer named in the path and can be referenced by any downstream attach call that takes a `fileId` for that customer.

## When to use this endpoint

Call this before [upserting a participant document](/engine/incorporation/partner-incorporation-participant-documents-PUT) for an incorporation, or before any future endpoint that accepts a `fileId`. A single `fileId` can be reused across multiple attach calls without re-uploading bytes.

## Request

Send a single multipart part named `file` containing the binary body. The part's filename and detected MIME type are stored as `fileName` and `mimeType` on the file record. No other fields are accepted.

## Limits

| Limit               | Value                                                                                                                                                                                                 |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Maximum file size   | 100 MB per request                                                                                                                                                                                    |
| Request timeout     | 120 seconds                                                                                                                                                                                           |
| Accepted MIME types | `application/pdf`, `image/png`, `image/jpeg`, `image/heic`, `image/heif`, `image/tiff`, `image/webp`, `application/msword`, `application/vnd.openxmlformats-officedocument.wordprocessingml.document` |

Requests that exceed the file-size limit return `413 Payload Too Large`. Requests with an unsupported MIME type return `415 Unsupported Media Type`. Commenda detects the MIME type from the uploaded part's content rather than trusting the declared `Content-Type` alone, so renaming a file extension does not change which limits apply.

If you need to upload files larger than 100 MB, contact Commenda. A separate direct-to-object-storage upload flow is available for those cases.

## Example

```bash theme={null}
curl --request POST \
  --url 'https://api.prod.commenda.io/api/v1/partner/commenda-os/customers/77/files' \
  --header 'x-api-key: <partner_api_key>' \
  --form 'file=@./passport.pdf;type=application/pdf'
```

```json theme={null}
{
  "file": {
    "fileId": 456,
    "fileName": "passport.pdf",
    "mimeType": "application/pdf",
    "fileSize": 382144,
    "customerId": 77
  }
}
```


## OpenAPI

````yaml POST /partner/commenda-os/customers/{customerId}/files
openapi: 3.0.1
info:
  title: Commenda Public APIs
  description: >-
    APIs for Commenda entity management, partner incorporation, indirect tax,
    compliance, and corporate operations.
  license:
    name: NONE
    url: NONE
  version: 1.0.0
servers:
  - url: https://api.prod.commenda.io/api/v1
    description: Commenda platform APIs, including Partner Incorporation and Commenda OS.
  - url: https://transaction-tax.api.in.commenda.io/api/v1
    description: Global Indirect Tax API.
security:
  - bearerAuth: []
paths:
  /partner/commenda-os/customers/{customerId}/files:
    post:
      summary: Upload a file
      description: >-
        Upload a file with multipart/form-data and receive a reusable fileId.
        Stores bytes only; does not link the file to any other resource. Use the
        returned fileId with a separate attach call to put the file to work.
      operationId: uploadPartnerCommendaOsCustomerFile
      parameters:
        - name: customerId
          in: path
          required: true
          schema:
            type: integer
          description: Commenda customer identifier.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/CommendaOsCustomerFileUploadRequest'
      responses:
        '201':
          description: File uploaded successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommendaOsCustomerFileResponse'
        '400':
          description: Missing file part or malformed multipart body
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommendaOsPartnerError'
        '401':
          description: Missing or invalid partner API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommendaOsPartnerError'
        '403':
          description: Customer does not belong to this partner firm
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommendaOsPartnerError'
        '404':
          description: Customer not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommendaOsPartnerError'
        '413':
          description: Uploaded file exceeds the 100 MB per-request size limit
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommendaOsPartnerError'
        '415':
          description: Detected MIME type of the uploaded file is not in the accepted list
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommendaOsPartnerError'
      security:
        - xApiKeyAuth: []
      servers:
        - url: https://api.prod.commenda.io/api/v1
components:
  schemas:
    CommendaOsCustomerFileUploadRequest:
      type: object
      required:
        - file
      properties:
        file:
          type: string
          format: binary
          description: >-
            Binary file part. The part filename and detected MIME type are
            recorded on the file. No other multipart fields are accepted.
    CommendaOsCustomerFileResponse:
      type: object
      required:
        - file
      properties:
        file:
          $ref: '#/components/schemas/CommendaOsCustomerFile'
    CommendaOsPartnerError:
      type: object
      required:
        - statusCode
        - message
        - error
      properties:
        statusCode:
          type: integer
          description: HTTP status code for the error response.
        message:
          description: >-
            Error message returned by the API. Exact text varies by failure
            mode.
          oneOf:
            - type: string
            - type: array
              items:
                type: string
        error:
          type: string
          description: Standard error label for the response status.
    CommendaOsCustomerFile:
      type: object
      required:
        - fileId
        - fileName
        - mimeType
        - fileSize
        - customerId
      properties:
        fileId:
          type: integer
          description: >-
            Commenda file id. Pass to a downstream attach call (for example,
            create a customer document or upsert a participant document) to put
            the file to work.
          example: 456
        fileName:
          type: string
          example: passport.pdf
        mimeType:
          type: string
          example: application/pdf
        fileSize:
          type: integer
          nullable: true
          example: 382144
        customerId:
          type: integer
          example: 77
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
    xApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````