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

# Upload Document

> Uploads a document to the account's application as `multipart/form-data`. Re-uploading the same document type replaces the previous file. Use `relatedPersonId` to attach the document to a specific related person.

Uploads a document to an account's application as `multipart/form-data`. Re-uploading the same `documentType` replaces the previous file. To attach a document to a specific beneficial owner or director, include their `relatedPersonId`.

## Example Request

```bash theme={null}
curl -X POST "https://api.rolla.xyz/api/v1/external/accounts/eec3cbed-79d8-4370-87a0-b6be9e287337/documents" \
  -H "X-API-Key: your_api_key_here" \
  -F "file=@/path/to/certificate.pdf" \
  -F "documentType=certificate_of_incorporation"
```

## Form Fields

| Field             | Type   | Required | Description                                      |
| ----------------- | ------ | -------- | ------------------------------------------------ |
| `file`            | file   | Yes      | The document file (max 50MB)                     |
| `documentType`    | string | Yes      | One of the document types below                  |
| `relatedPersonId` | string | No       | Attach the document to a specific related person |

## Document Types

**Required for business accounts:** `certificate_of_incorporation`, `articles_of_association`, `proof_of_address`, `director_register`, `shareholder_register`, `bank_statement`

**Required for each beneficial owner and director:** `proof_of_address`, `source_of_wealth_doc` — upload with that person's `relatedPersonId`

**Required for individual accounts:** `proof_of_address`

**Optional / compliance:** `proof_of_tax_id`, `wolfsberg_questionnaire`, `msb_flow_form`, `flow_of_funds_diagram`, `aml_policy_procedures`, `ach_procedures`, `wire_procedures`, `customer_complaint_procedures`, `prohibited_jurisdictions_industries`

## Example Response

```json theme={null}
{
  "success": true,
  "message": "Document uploaded successfully",
  "data": {
    "id": "0c95b2a1-7a93-4a3a-9a52-2a1f0b9b3c11",
    "kyb_application_id": "fbb45236-881a-4c58-8954-22759499eab4",
    "document_type": "certificate_of_incorporation",
    "file_name": "certificate.pdf",
    "file_size": 248301,
    "mime_type": "application/pdf"
  }
}
```

<Tip>
  Proof of address documents must have been issued within the last 3 months (bank statement, utility bill or lease agreement).
</Tip>


## OpenAPI

````yaml POST /accounts/{accountId}/documents
openapi: 3.1.0
info:
  title: Rolla Developer API
  description: >-
    API for programmatic transaction management on the Rolla platform. Monetary
    `amount` fields use the smallest unit of the referenced currency unless an
    endpoint says otherwise (e.g. NGN = kobo, USD = cents, where **100 cents =
    USD 1.00**).
  version: 1.0.0
servers:
  - url: https://api.rolla.xyz/api/v1/external
    description: Production server
security:
  - apiKeyAuth: []
paths:
  /accounts/{accountId}/documents:
    post:
      summary: Upload Document
      description: >-
        Uploads a document to the account's application as
        `multipart/form-data`. Re-uploading the same document type replaces the
        previous file. Use `relatedPersonId` to attach the document to a
        specific related person.
      operationId: uploadAccountDocument
      parameters:
        - name: accountId
          in: path
          required: true
          description: >-
            Identifier of an account owned by the same user as your API key's
            business
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - file
                - documentType
              properties:
                file:
                  type: string
                  format: binary
                documentType:
                  type: string
                  enum:
                    - certificate_of_incorporation
                    - articles_of_association
                    - proof_of_address
                    - director_register
                    - shareholder_register
                    - proof_of_tax_id
                    - bank_statement
                    - wolfsberg_questionnaire
                    - msb_flow_form
                    - flow_of_funds_diagram
                    - aml_policy_procedures
                    - ach_procedures
                    - wire_procedures
                    - customer_complaint_procedures
                    - prohibited_jurisdictions_industries
                relatedPersonId:
                  type: string
                  format: uuid
      responses:
        '201':
          description: Document uploaded successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: Document uploaded successfully
                  data:
                    $ref: '#/components/schemas/KybDocument'
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Account or related person not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    KybDocument:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Document identifier
        applicationId:
          type: string
          description: Associated KYB application ID
        documentType:
          type: string
          description: Type of document
          enum:
            - certificate_of_incorporation
            - articles_of_association
            - proof_of_address
            - director_register
            - shareholder_register
        fileName:
          type: string
          description: Uploaded file name
        fileUrl:
          type: string
          format: uri
          description: Document download URL
        relatedPersonKey:
          type: string
          description: Associated related person
        created_at:
          type: string
          format: date-time
          description: Upload timestamp
    Error:
      type: object
      properties:
        success:
          type: boolean
          example: false
        message:
          type: string
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: Your Rolla API key

````