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

# Upload the store's digital certificate and set NF-e numbering (Brazil)

> Brazil only. Uploads the store's A1 digital certificate (the `.pfx`/`.p12` file used to
sign NF-e) and, in the same call, sets the NF-e series and the next invoice number. The
store is derived from the credential used to obtain the token; no store id is accepted.
Requires the fiscal account to exist already (`POST /store/fiscal-account`).

- Every call overwrites the store's NF-e counter. `next_invoice_number` must be the
  number of the next NF-e the store will actually issue, not the last one used and not
  `1` for a store that has already issued invoices. Reusing a number makes the tax
  authority reject the following invoices as duplicates.
- `invoice_series` and `next_invoice_number` are accepted as strings or integers and are
  parsed in base 10, so zero-padded values such as `"089"` are read as 89.
- The certificate and its password are never returned or logged.
- After upload, the certificate validity is read back on a best-effort basis; if it
  cannot be read, `status` is `active` and `days_until_expiration`/`expires_at` are null.




## OpenAPI

````yaml /openapi.yaml post /store/digital-certificate
openapi: 3.1.0
info:
  title: Cubbo Clients API
  version: '1.0'
  summary: >-
    Orders, inventory, replenishments, returns, shipping and webhooks for Cubbo
    fulfillment.
  description: >
    The Cubbo Clients API connects your store, ERP or marketplace with Cubbo's
    fulfillment network.

    All endpoints except `POST /auth/token` require a bearer token; see the
    Authentication guide.

    Request and response bodies are JSON. Errors are JSON objects with an
    `error` key.
  contact:
    name: Cubbo integrations
    email: integraciones@cubbo.com
servers:
  - url: https://api.cubbo.com/v1
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Authentication
    description: Exchange client credentials for a bearer token.
  - name: Orders
    description: Create, update, hold, cancel and read sales orders.
  - name: Shipping labels
    description: Read the shipping labels generated for an order.
  - name: Inventory
    description: Products and stock per store.
  - name: Lots
    description: Lot-level inventory for products with expiration or batch tracking.
  - name: Reports
    description: Bulk reports for reconciliation.
  - name: Replenishments
    description: Inbound shipments to the warehouse.
  - name: Returns
    description: Returns and exchanges.
  - name: Stores
    description: Store provisioning and settings.
  - name: Shipping methods
    description: Available shipping methods, coverage and quotes.
  - name: Click and collect
    description: Pickup points and in-store pickup orders.
paths:
  /store/digital-certificate:
    post:
      tags:
        - Stores
      summary: Upload the store's digital certificate and set NF-e numbering (Brazil)
      description: >
        Brazil only. Uploads the store's A1 digital certificate (the
        `.pfx`/`.p12` file used to

        sign NF-e) and, in the same call, sets the NF-e series and the next
        invoice number. The

        store is derived from the credential used to obtain the token; no store
        id is accepted.

        Requires the fiscal account to exist already (`POST
        /store/fiscal-account`).


        - Every call overwrites the store's NF-e counter. `next_invoice_number`
        must be the
          number of the next NF-e the store will actually issue, not the last one used and not
          `1` for a store that has already issued invoices. Reusing a number makes the tax
          authority reject the following invoices as duplicates.
        - `invoice_series` and `next_invoice_number` are accepted as strings or
        integers and are
          parsed in base 10, so zero-padded values such as `"089"` are read as 89.
        - The certificate and its password are never returned or logged.

        - After upload, the certificate validity is read back on a best-effort
        basis; if it
          cannot be read, `status` is `active` and `days_until_expiration`/`expires_at` are null.
      operationId: uploadStoreDigitalCertificate
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DigitalCertificateRequest'
            example:
              certificate_base64: <base64-encoded-pfx-file>
              certificate_password: <certificate-password>
              invoice_series: 1
              next_invoice_number: 4567
      responses:
        '200':
          description: Certificate uploaded and numbering configured
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DigitalCertificateResponse'
              example:
                store_id: 4821
                certificate:
                  status: active
                  days_until_expiration: 365
                  expires_at: '2027-09-03'
                  uploaded_at: '2026-09-03T14:10:03Z'
                invoice_numbering:
                  series: 1
                  next_number: 4567
        '401':
          description: Missing or invalid token, or the credential is not bound to a store
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedError'
              example:
                error: Unauthorized
                message: credential is not bound to a store
        '422':
          description: Validation or business error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                missingCertificate:
                  value:
                    error: Parameter certificate_base64 is required
                invalidSeriesFormat:
                  value:
                    error: >-
                      invoice_series must be a positive integer with at most 3
                      digits
                invalidNumberFormat:
                  value:
                    error: >-
                      next_invoice_number must be a positive integer with at
                      most 9 digits
                seriesOutOfRange:
                  value:
                    error: invoice_series must be an integer between 1 and 999.
                numberOutOfRange:
                  value:
                    error: >-
                      next_invoice_number must be an integer between 1 and
                      999999999.
                invalidBase64:
                  value:
                    error: certificate_base64 is not valid Base64.
                storeNotConfigured:
                  value:
                    error: Store 4821 is not configured to issue fiscal documents.
                wrongPassword:
                  value:
                    error: Incorrect certificate password.
                invalidFormat:
                  value:
                    error: >-
                      The digital certificate is corrupted or in an invalid
                      format. Export it again as .pfx or .p12.
                numberingRejected:
                  value:
                    error: >-
                      The fiscal provider rejected the NF-e series or number.
                      Confirm them with your accountant.
        '500':
          $ref: '#/components/responses/InternalServerError'
      security:
        - bearerAuth: []
components:
  schemas:
    DigitalCertificateRequest:
      type: object
      required:
        - certificate_base64
        - certificate_password
        - invoice_series
        - next_invoice_number
      properties:
        certificate_base64:
          type: string
          format: byte
          description: The A1 certificate file (`.pfx`/`.p12`) encoded in Base64
          example: <base64-encoded-pfx-file>
        certificate_password:
          type: string
          description: Export password of the certificate
          example: <certificate-password>
        invoice_series:
          type:
            - integer
            - string
          description: NF-e series, 1 to 999. Digits only; parsed in base 10.
          example: 1
        next_invoice_number:
          type:
            - integer
            - string
          description: >-
            Number of the next NF-e the store will issue, 1 to 999999999. Digits
            only; parsed in base 10.
          example: 4567
    DigitalCertificateResponse:
      type: object
      required:
        - store_id
        - certificate
        - invoice_numbering
      properties:
        store_id:
          type: integer
          description: Id of the store
          example: 4821
        certificate:
          type: object
          required:
            - status
            - days_until_expiration
            - expires_at
            - uploaded_at
          properties:
            status:
              type: string
              description: >-
                `active`, or `expired` when the uploaded certificate is already
                past its validity
              enum:
                - active
                - expired
              example: active
            days_until_expiration:
              type:
                - integer
                - 'null'
              description: >-
                Days until the certificate expires; null if the validity could
                not be read back
              example: 365
            expires_at:
              type:
                - string
                - 'null'
              format: date
              description: Expiration date; null if the validity could not be read back
              example: '2027-09-03'
            uploaded_at:
              type: string
              format: date-time
              description: When the certificate was uploaded
              example: '2026-09-03T14:10:03Z'
        invoice_numbering:
          type: object
          required:
            - series
            - next_number
          properties:
            series:
              type: integer
              description: NF-e series configured
              example: 1
            next_number:
              type: integer
              description: Next NF-e number configured
              example: 4567
    UnauthorizedError:
      type: object
      description: Body of every 401 response
      properties:
        error:
          type: string
          description: Always `Unauthorized`
          example: Unauthorized
        message:
          type: string
          description: Why the request was refused
          example: invalid token
      required:
        - error
        - message
    Error:
      type: object
      description: Error body returned by every failed request.
      required:
        - error
      properties:
        error:
          type: string
          description: >-
            Human-readable description of the failure. For `401` responses it is
            always `Unauthorized`.
          example: Parameter store_id is required
        message:
          type: string
          description: >-
            Present on `401` responses only; the reason the request was
            rejected.
          example: invalid token
        code:
          type:
            - string
            - 'null'
          description: >-
            Stable machine-readable code, present on some order, return and
            replenishment errors.
          example: ORDER_ALREADY_EXISTS
        context:
          type:
            - object
            - 'null'
          description: >-
            Extra data about the failure when available, for example the id of
            the conflicting order.
          additionalProperties: true
          example:
            order_id: 987654
  responses:
    InternalServerError:
      description: >-
        Unexpected error. Retry with backoff; if it persists, send the timestamp
        to Cubbo support.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: 'unexpected error, timestamp: 1760000000'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Token returned by `POST /auth/token`, sent as `Authorization: Bearer
        <token>`.

````

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