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

# Create a commit

> Certifies exactly the approved option. A stale option is refused (410 option_expired, 409 stale_snapshot,
409 prices_moved) with replacement_option_id when Abacus Labs can build one, unless on_stale is "resolve". One commit per
option. Commit records a decision; Abacus Labs places no orders.



## OpenAPI

````yaml /openapi.json post /commits
openapi: 3.1.0
info:
  title: Abacus Labs
  description: Portfolio analysis and decision API for AI agents. Read /agent.md first.
  version: 1.0.0
servers:
  - url: https://api.abacuslabs.ai/v1
    description: Abacus Labs API
security:
  - bearer: []
tags:
  - name: Onboarding
  - name: Analyze
  - name: Proposals
  - name: Trade checks
  - name: Commits
  - name: Accounts
paths:
  /commits:
    post:
      tags:
        - Commits
      summary: Create a commit
      description: >-
        Certifies exactly the approved option. A stale option is refused (410
        option_expired, 409 stale_snapshot,

        409 prices_moved) with replacement_option_id when Abacus Labs can build
        one, unless on_stale is "resolve". One commit per

        option. Commit records a decision; Abacus Labs places no orders.
      operationId: create_commit_v1_commits_post
      parameters:
        - name: Idempotency-Key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Idempotency-Key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CommitV1Body'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    CommitV1Body:
      properties:
        option_id:
          type: string
          title: Option Id
        reference:
          anyOf:
            - type: string
              maxLength: 128
            - type: 'null'
          title: Reference
          description: your own id for this decision; unique per key
        current_snapshot_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Current Snapshot Id
          description: >-
            the snapshot_id of the book as it is now; a commit on a changed book
            is refused (409 stale_snapshot)
        on_stale:
          type: string
          enum:
            - reject
            - resolve
          title: On Stale
          description: >-
            reject (default): refuse a stale option and offer
            replacement_option_id; resolve: re-solve and commit the fresh option
            (recorded in the certificate)
          default: reject
        fills:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Fills
          description: >-
            executions already done at the broker: [{id, symbol, side, qty,
            price, date?, lots?}]; a saved account is updated (lots, cash,
            history)
      type: object
      required:
        - option_id
      title: CommitV1Body
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: >-
        An API key: abacus_sk_test_... (sandbox, from POST /v1/keys) or
        abacus_sk_live_... (from https://app.abacuslabs.ai)

````

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