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

# Post a journal entry

> Post a double-entry journal. The sum of debits must equal the sum of credits; we validate and balance server-side before anything touches the ledger. Always send an `Idempotency-Key` so a retried request never double-posts.



## OpenAPI

````yaml /openapi.json post /v1/journals
openapi: 3.1.0
info:
  title: 3Rings API
  version: 1.0.0
  summary: Embedded double-entry accounting infrastructure.
  description: >-
    The 3Rings API lets you embed real double-entry accounting into your
    product. Create a business you serve, provision its chart of accounts, post
    balanced journals, and read financial statements — all on the same guarded
    core that powers 3Rings.


    All amounts are **integers in the currency's minor unit** (e.g. kobo for
    NGN, cents for USD). All write endpoints accept an `Idempotency-Key` so
    retries are safe. Balancing and posting are authoritative on our side: you
    send the intent, we keep the books correct.
  contact:
    name: 3Rings Developer Support
    url: https://docs.3ringscapital.co/support
    email: developers@3ringscapital.co
  license:
    name: Proprietary
    url: https://3ringscapital.co/terms-of-use
servers:
  - url: https://api.3ringscapital.co
    description: Production
  - url: https://api-sandbox.3ringscapital.co
    description: Sandbox
security:
  - bearerAuth: []
tags:
  - name: Businesses
    description: >-
      The businesses you serve, modelled as sub-accounts under your partner
      account.
  - name: Chart of Accounts
    description: The ledger accounts each business posts against.
  - name: Journals
    description: >-
      Double-entry journal entries. Debits and credits must balance; we enforce
      it server-side.
  - name: Statements
    description: Trial balance, profit & loss and balance sheet, computed from the ledger.
  - name: Categorization
    description: Classify a transaction into a chart-of-accounts category with AI.
paths:
  /v1/journals:
    post:
      tags:
        - Journals
      summary: Post a journal entry
      description: >-
        Post a double-entry journal. The sum of debits must equal the sum of
        credits; we validate and balance server-side before anything touches the
        ledger. Always send an `Idempotency-Key` so a retried request never
        double-posts.
      operationId: postJournal
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/JournalCreate'
            example:
              businessId: biz_9f2
              narration: Office rent — November
              currency: NGN
              entries:
                - type: debit
                  accountId: acc_rent
                  amount: 25000000
                - type: credit
                  accountId: acc_cash
                  amount: 25000000
      responses:
        '201':
          description: Journal posted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Journal'
              example:
                id: jrnl_7x2a9
                status: posted
                balanced: true
                businessId: biz_9f2
                currency: NGN
                narration: Office rent — November
                entries:
                  - type: debit
                    accountId: acc_rent
                    amount: 25000000
                  - type: credit
                    accountId: acc_cash
                    amount: 25000000
                postedAt: '2026-11-08T09:24:11Z'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/Unprocessable'
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      description: >-
        A unique key (e.g. a UUID) that makes a write safe to retry. Replaying
        the same key returns the original result instead of creating a
        duplicate.
      schema:
        type: string
        maxLength: 255
      example: a1b2c3d4-0000-4000-8000-000000000000
  schemas:
    JournalCreate:
      type: object
      required:
        - businessId
        - entries
      properties:
        businessId:
          type: string
          example: biz_9f2
        narration:
          type: string
          example: Office rent — November
        currency:
          type: string
          description: ISO 4217 code; defaults to the business base currency.
          example: NGN
        date:
          type: string
          format: date
          description: Posting date; defaults to today.
        entries:
          type: array
          minItems: 2
          description: At least two lines whose debits and credits balance.
          items:
            $ref: '#/components/schemas/JournalEntry'
    Journal:
      type: object
      required:
        - id
        - businessId
        - status
        - balanced
        - entries
      properties:
        id:
          type: string
          example: jrnl_7x2a9
        businessId:
          type: string
          example: biz_9f2
        status:
          type: string
          enum:
            - posted
            - reversed
          example: posted
        balanced:
          type: boolean
          example: true
        currency:
          type: string
          example: NGN
        narration:
          type: string
          example: Office rent — November
        entries:
          type: array
          items:
            $ref: '#/components/schemas/JournalEntry'
        postedAt:
          type: string
          format: date-time
          example: '2026-11-08T09:24:11Z'
    JournalEntry:
      type: object
      required:
        - type
        - accountId
        - amount
      properties:
        type:
          type: string
          enum:
            - debit
            - credit
          example: debit
        accountId:
          type: string
          example: acc_rent
        amount:
          type: integer
          description: >-
            Amount in the currency's minor unit (e.g. kobo, cents). Always
            positive.
          minimum: 1
          example: 25000000
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - type
            - message
          properties:
            type:
              type: string
              description: A stable, machine-readable error type.
              example: invalid_request
            message:
              type: string
              description: A human-readable explanation.
              example: businessId is required.
            code:
              type: string
              description: A dotted sub-code for finer handling.
              example: business.missing
            param:
              type: string
              description: The offending parameter, when applicable.
  responses:
    BadRequest:
      description: The request was malformed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: The resource does not exist.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unprocessable:
      description: >-
        The request was well-formed but could not be processed (e.g. a journal
        whose debits and credits do not balance).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              type: unbalanced_journal
              message: Debits (25000000) do not equal credits (24000000).
              code: journal.unbalanced
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Authenticate with your secret API key as a bearer token: `Authorization:
        Bearer 3r_live_...`. Keys are issued per partner from the dashboard; use
        `3r_test_...` against the sandbox. Never expose a secret key in
        client-side code.

````

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