Octobat Invoices API

Compliant invoices, their items, and lifecycle actions.

OpenAPI Specification

octobat-invoices-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Octobat Coupons Invoices API
  description: 'Octobat is a billing, invoicing, and tax-compliance platform for online businesses. This OpenAPI document describes the public REST API at base URL https://apiv2.octobat.com. The API is Stripe-style: resource-oriented, form or JSON request bodies, and HTTP Basic authentication using your secret key as the username with an empty password (curl: -u sk_live_xxx:). Test-mode keys (sk_test_) and live-mode keys (sk_live_) select the environment.


    Endpoint provenance: paths marked "confirmed" are demonstrated directly in Octobat''s own documentation (register-transactions and tax-calculation guides). The remaining CRUD and action paths are modeled from Octobat''s official Ruby SDK (github.com/0ctobat/octobat-ruby), which derives resource URLs as the snake_cased, pluralized class name and uses POST to create, PATCH to update, GET to retrieve/list, and DELETE to remove. Request and response schemas are representative, not exhaustive; consult the live API reference at https://v2apidoc.octobat.com for full field-level detail.


    Operating status: Octobat was acquired by Mirakl in November 2021. The standalone marketing site now redirects to mirakl.com; docs.octobat.com and apiv2.octobat.com remain available to existing integrators.'
  version: '2.0'
  contact:
    name: Octobat
    url: https://docs.octobat.com
    email: support@octobat.com
servers:
- url: https://apiv2.octobat.com
  description: Octobat API v2 (production)
security:
- basicAuth: []
tags:
- name: Invoices
  description: Compliant invoices, their items, and lifecycle actions.
paths:
  /invoices:
    get:
      operationId: listInvoices
      tags:
      - Invoices
      summary: List invoices
      description: Lists invoices. Supports filtering by customer and by status, including due / unpaid invoices, via query parameters.
      parameters:
      - name: customer
        in: query
        required: false
        schema:
          type: string
        description: Filter by customer ID.
      - name: status
        in: query
        required: false
        schema:
          type: string
          enum:
          - draft
          - confirmed
          - paid
          - due
          - uncollectible
          - cancelled
        description: Filter by invoice status (use "due" for unpaid invoices).
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          default: 10
      responses:
        '200':
          description: A list of invoices.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceList'
        '401':
          $ref: '#/components/responses/Unauthorized'
    post:
      operationId: createInvoice
      tags:
      - Invoices
      summary: Create an invoice
      description: Creates a new invoice for a customer. (Confirmed in Octobat docs.)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InvoiceCreate'
      responses:
        '200':
          description: The created invoice.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Invoice'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /invoices/{id}:
    parameters:
    - name: id
      in: path
      required: true
      schema:
        type: string
    get:
      operationId: retrieveInvoice
      tags:
      - Invoices
      summary: Retrieve an invoice
      responses:
        '200':
          description: The requested invoice.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Invoice'
        '401':
          $ref: '#/components/responses/Unauthorized'
    patch:
      operationId: updateInvoice
      tags:
      - Invoices
      summary: Update an invoice
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InvoiceCreate'
      responses:
        '200':
          description: The updated invoice.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Invoice'
        '401':
          $ref: '#/components/responses/Unauthorized'
    delete:
      operationId: deleteInvoice
      tags:
      - Invoices
      summary: Delete an invoice
      responses:
        '200':
          description: The invoice was deleted.
        '401':
          $ref: '#/components/responses/Unauthorized'
  /invoices/{id}/items:
    parameters:
    - name: id
      in: path
      required: true
      schema:
        type: string
    post:
      operationId: createInvoiceItem
      tags:
      - Invoices
      summary: Add an item to an invoice
      description: Adds a line item to an invoice. Provide a tax_evidence ID (from the Tax Evidence API) or explicit tax parameters. (Confirmed in Octobat docs.)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InvoiceItemCreate'
      responses:
        '200':
          description: The created invoice item.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Item'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /invoices/{id}/confirm:
    parameters:
    - name: id
      in: path
      required: true
      schema:
        type: string
    patch:
      operationId: confirmInvoice
      tags:
      - Invoices
      summary: Confirm (finalize) an invoice
      description: Confirms an invoice, assigning it a sequential legal number and making it immutable. (Confirmed in Octobat docs.)
      responses:
        '200':
          description: The confirmed invoice.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Invoice'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /invoices/{id}/send:
    parameters:
    - name: id
      in: path
      required: true
      schema:
        type: string
    post:
      operationId: sendInvoice
      tags:
      - Invoices
      summary: Send an invoice by email
      responses:
        '200':
          description: The invoice, after sending.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Invoice'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /invoices/{id}/set_payment_terms:
    parameters:
    - name: id
      in: path
      required: true
      schema:
        type: string
    patch:
      operationId: setInvoicePaymentTerms
      tags:
      - Invoices
      summary: Set payment terms on an invoice
      responses:
        '200':
          description: The updated invoice.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Invoice'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /invoices/{id}/mark_uncollectible:
    parameters:
    - name: id
      in: path
      required: true
      schema:
        type: string
    patch:
      operationId: markInvoiceUncollectible
      tags:
      - Invoices
      summary: Mark an invoice uncollectible
      responses:
        '200':
          description: The updated invoice.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Invoice'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /invoices/{id}/cancel:
    parameters:
    - name: id
      in: path
      required: true
      schema:
        type: string
    patch:
      operationId: cancelInvoice
      tags:
      - Invoices
      summary: Cancel an invoice
      responses:
        '200':
          description: The cancelled invoice.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Invoice'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /invoices/{id}/cancel_and_replace:
    parameters:
    - name: id
      in: path
      required: true
      schema:
        type: string
    patch:
      operationId: cancelAndReplaceInvoice
      tags:
      - Invoices
      summary: Cancel and replace an invoice
      responses:
        '200':
          description: The replacement invoice.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Invoice'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /invoices/pdf_export:
    post:
      operationId: exportInvoicesPdf
      tags:
      - Invoices
      summary: Export invoices to PDF
      responses:
        '200':
          description: Export accepted.
        '401':
          $ref: '#/components/responses/Unauthorized'
  /invoices/csv_export:
    post:
      operationId: exportInvoicesCsv
      tags:
      - Invoices
      summary: Export invoices to CSV
      responses:
        '200':
          description: Export accepted.
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    InvoiceItemCreate:
      type: object
      properties:
        currency:
          type: string
        gross_amount:
          type: integer
        description:
          type: string
        tax_evidence:
          type: string
          description: Tax evidence ID from the Tax Evidence API.
        tax:
          type: string
        tax_rate:
          type: number
        declare_in_region:
          type: string
        product_type:
          type: string
    InvoiceCreate:
      type: object
      properties:
        customer:
          type: string
          description: Octobat customer ID.
        currency:
          type: string
          example: EUR
        description:
          type: string
    Item:
      type: object
      properties:
        id:
          type: string
        object:
          type: string
          example: item
        invoice:
          type: string
        gross_amount:
          type: integer
        description:
          type: string
    Invoice:
      type: object
      properties:
        id:
          type: string
        object:
          type: string
          example: invoice
        customer:
          type: string
        currency:
          type: string
        status:
          type: string
          enum:
          - draft
          - confirmed
          - paid
          - due
          - uncollectible
          - cancelled
        number:
          type: string
          description: Sequential legal number
          assigned on confirm.: null
        total:
          type: integer
        total_tax:
          type: integer
        description:
          type: string
        created:
          type: integer
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            type:
              type: string
              example: authentication_error
            message:
              type: string
    InvoiceList:
      type: object
      properties:
        object:
          type: string
          example: list
        data:
          type: array
          items:
            $ref: '#/components/schemas/Invoice'
  responses:
    Unauthorized:
      description: Authentication failed - missing or invalid secret key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: 'HTTP Basic authentication. Use your Octobat secret key as the username and leave the password empty (curl: -u sk_live_xxx:). Use sk_test_ keys for test mode and sk_live_ keys for live mode.'