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

# Upload Merchant Invoice

> Attach an invoice file to one of your sub-merchants.

## Overview

Attaches an invoice to a sub-merchant you have onboarded. The request is `multipart/form-data`, not JSON. Uploading again replaces the stored invoice.

The upload is accepted in any status. The invoice is not returned by [Get Merchant](https://docs.eximpe.com/api-reference/v3/merchant/get.md) or [List Merchants](https://docs.eximpe.com/api-reference/v3/merchant/list.md).

## Path Parameters

| Name | Type | Required | Description |
| - | - | - | - |
| merchant\_id | string | Yes | The sub-merchant's ID, as returned by [Create Merchant](https://docs.eximpe.com/api-reference/v3/merchant/create.md), e.g. `6182929449`. |

## Request Parameters

| Name | Type | Required | Description | Constraints |
| - | - | - | - | - |
| document\_type | string | Yes | The kind of document. | `INVOICE`. No other document type is accepted. |
| file | file | Yes | The invoice file. | One of `pdf`, `jpg`, `jpeg`, `png`, `csv`, `xlsx` or `docx`; the file's content must match its extension. Up to 10 MB, with a file name of up to 100 characters. A PDF must not be password-protected and must pass EximPe's security check. |

## Response

```json 200 Uploaded theme={null}
{
  "success": true,
  "message": "Invoice uploaded successfully",
  "data": {
    "detail": "Invoice uploaded successfully"
  }
}
```

```json 400 Validation error theme={null}
{
  "success": false,
  "error": {
    "code": "ERR_MERCHANT_001",
    "message": "Validation error",
    "details": {
      "document_type": ["\"RECEIPT\" is not a valid choice."]
    }
  }
}
```

## Errors

Errors use the standard envelope. For a `400`, `details` lists every problem, each field mapped to a list of messages; otherwise it is an empty object. See [Create Merchant](https://docs.eximpe.com/api-reference/v3/merchant/create.md#errors).

| Status | `error.code` | When | `details` |
| - | - | - | - |
| `400` | `ERR_MERCHANT_001` | `document_type` or `file` is missing, `document_type` is not `INVOICE`, or the file breaks a rule above | Keyed by field, each with a list of reasons, e.g. `{"document_type": ["\"RECEIPT\" is not a valid choice."]}`. Fix it and upload again |
| `401` | `ERR_AUTH_000`, `ERR_AUTH_001` | `X-Client-ID` or `X-Client-Secret` is missing or wrong | `{"authentication": "Missing credentials."}` or `{"authentication": "Invalid credentials."}` |
| `403` | `ERR_AUTH_003` | Your account is not a PSP | `{}`. Only PSPs can manage sub-merchants |
| `403` | `ERR_MERCHANT_017` | Your account is a PSP, but not set up for import collections | `{}`. Contact EximPe |
| `404` | `ERR_MERCHANT_016` | No sub-merchant with this ID belongs to you, or it has been deleted | `{}`. Check the ID |


## OpenAPI

````yaml openapi/v3-partner-merchants.json PATCH /partners/merchants/{merchant_id}/documents/
openapi: 3.0.0
info:
  title: EximPe Payment Gateway API — v3 Partner Merchants
  version: 3.0.0
  description: Create and manage sub-merchants on the v3 partner API.
servers:
  - url: https://api-pacb-uat.eximpe.com
    description: Payment Gateway Sandbox URL
security:
  - clientAuth: []
    clientSecretAuth: []
    apiVersionHeader: []
tags:
  - name: Merchants
paths:
  /partners/merchants/{merchant_id}/documents/:
    patch:
      tags:
        - Merchants
      summary: Upload Merchant Invoice
      description: >-
        Attach an invoice file to one of your sub-merchants. The request is
        multipart/form-data. Uploading again replaces the stored invoice.
      operationId: v3_uploadMerchantInvoice
      parameters:
        - name: merchant_id
          in: path
          required: true
          description: The sub-merchant's ID.
          schema:
            type: string
      requestBody:
        description: multipart/form-data with the document type and the file.
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
                  description: >-
                    The invoice file: pdf, jpg, jpeg, png, csv, xlsx or docx, up
                    to 10 MB, with a file name of up to 100 characters. The
                    content must match the extension. A PDF must not be
                    password-protected and must pass EximPe's security check.
                document_type:
                  type: string
                  enum:
                    - INVOICE
                  description: Always `INVOICE`. No other document type is accepted.
              required:
                - file
                - document_type
            example:
              document_type: INVOICE
              file: invoice.pdf
      responses:
        '200':
          description: Invoice uploaded.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                  data:
                    type: object
                    properties:
                      detail:
                        type: string
              example:
                success: true
                message: Invoice uploaded successfully
                data:
                  detail: Invoice uploaded successfully
        '400':
          description: >-
            `document_type` or `file` is missing, `document_type` is not
            `INVOICE`, or the file breaks a rule (`ERR_MERCHANT_001`; `details`
            maps each field to a list of messages).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v3_SubMerchantErrorResponse'
              example:
                success: false
                error:
                  code: ERR_MERCHANT_001
                  message: Validation error
                  details:
                    document_type:
                      - '"RECEIPT" is not a valid choice.'
        '401':
          description: Missing or invalid credentials.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v3_ErrorResponse'
              example:
                success: false
                error:
                  code: ERR_AUTH_000
                  message: Missing credentials
                  details:
                    authentication: Missing credentials.
        '403':
          description: >-
            Your account is not a PSP (`ERR_AUTH_003`), or is a PSP not set up
            for import collections (`ERR_MERCHANT_017`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v3_ErrorResponse'
              example:
                success: false
                error:
                  code: ERR_MERCHANT_017
                  message: >-
                    Sub-Merchant endpoints are only available to IMPORT PSP
                    accounts
                  details: {}
        '404':
          description: No sub-merchant with this ID belongs to you, or it has been deleted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v3_ErrorResponse'
              example:
                success: false
                error:
                  code: ERR_MERCHANT_016
                  message: Sub-Merchant not found
                  details: {}
      security:
        - clientAuth: []
          clientSecretAuth: []
          apiVersionHeader: []
components:
  schemas:
    v3_SubMerchantErrorResponse:
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          enum:
            - false
          description: >-
            Indicates if the request was successful. Always false for error
            responses.
        error:
          $ref: '#/components/schemas/v3_SubMerchantErrorDetails'
    v3_ErrorResponse:
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          enum:
            - false
          description: >-
            Indicates if the request was successful. Always false for error
            responses.
        error:
          $ref: '#/components/schemas/v3_ErrorDetails'
    v3_SubMerchantErrorDetails:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: >-
            Error code. When the only problems are of one kind it is that kind's
            code (`ERR_MERCHANT_005`, `ERR_MERCHANT_006`, `ERR_MERCHANT_019`, or
            `ERR_MERCHANT_001` for fields that are not accepted); any other mix
            is `ERR_MERCHANT_001`.
        message:
          type: string
          description: >-
            Error message. `Validation error` for a mix of problems; otherwise
            the message of the one kind of problem, e.g.
            `global_company.category is not accepted`.
        details:
          description: >-
            Every problem found in the request. Each field maps to a list of
            messages, with nested objects for `global_company` and
            `settlement_details` and one entry per owner in `beneficial_owners`
            (`{}` for an owner with no errors). Fields that are not accepted,
            `status`, `sub_merchant_status` or `is_active`, and bank fields the
            SWIFT lookup could not fill are listed alongside the other field
            errors. Rules across fields (the HS code rule, the communication
            address, the ownership total) are reported once the other fields in
            their section are valid. An empty object when there is nothing to
            add.
          type: object
          additionalProperties: true
    v3_ErrorDetails:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: Error code (e.g., ERR_ORDER_002)
        message:
          type: string
          description: Error message
        details:
          description: >-
            More about the error. An object keyed by field name when fields fail
            validation, with nested objects for nested fields; a string when the
            error is about the request as a whole; or an empty object when there
            is nothing to add.
          oneOf:
            - type: object
              additionalProperties: true
            - type: string
  securitySchemes:
    clientAuth:
      type: apiKey
      name: X-Client-ID
      in: header
      description: >-
        **Client Application ID** - Your unique application identifier used to
        authenticate API requests. You can find your Client ID in the Developer
        Settings section of the merchant dashboard.
      x-displayName: Client ID
      x-example: your-client-id
    clientSecretAuth:
      type: apiKey
      name: X-Client-Secret
      in: header
      description: >-
        **Client Secret Key** - Your secret key used alongside the Client ID for
        secure authentication. Keep this confidential and never expose it in
        client-side code. Available in the Developer Settings section of the
        merchant dashboard.
      x-displayName: Client Secret
      x-example: your-client-secret
    apiVersionHeader:
      type: apiKey
      name: X-API-Version
      in: header
      description: >-
        **API Version** - Specifies which version of the API to use (e.g.,
        '1.X.X', '2.X.X', or '3.X.X'). This header allows you to control which
        API version your integration uses. Default version information is
        available in the Developer Settings.
      x-displayName: API Version
      x-example: 3.0.0

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.