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

# Create transaction



## OpenAPI

````yaml /openapi.json post /api/v1/transactions
openapi: 3.0.3
info:
  title: Grain API
  description: >-
    Church accounting and donor management API. Authenticate via OAuth 2.1 (Sign
    in with Grain). All requests require a Bearer token and X-Organization-Id
    header.
  version: 1.0.0
servers:
  - url: https://api.grainledger.com
    description: API Server
security:
  - GrainOAuth2: []
  - BearerAuth: []
tags:
  - name: Transactions
    description: Bank transactions and reconciliation
  - name: Bills
    description: Vendor bills from creation through payment
  - name: Donors
    description: Donor records and household relationships
  - name: Contributions
    description: Giving records with fund assignment and settlement
  - name: Pledges
    description: Pledge campaigns and fulfillment tracking
  - name: Households
    description: Household groupings and primary contacts
paths:
  /api/v1/transactions:
    post:
      tags:
        - Transactions
      summary: Create transaction
      parameters:
        - $ref: '#/components/parameters/OrganizationId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateTransaction'
            examples:
              deposit:
                value:
                  description: Weekly offering deposit
                  amount: 4250
                  date: '2026-07-01'
                  transactionType: DEPOSIT
                  referenceNumber: DEP-2026-0701
      responses:
        '201':
          description: Created transaction
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Transaction'
        '400':
          description: Bad request (missing header or invalid input)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized (missing or invalid Bearer token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden (no access to organization or action)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: Conflict (duplicate record)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  parameters:
    OrganizationId:
      name: X-Organization-Id
      in: header
      required: true
      schema:
        type: string
      description: Organization ID for multi-tenant data access
      example: cm123abc456def
  schemas:
    CreateTransaction:
      type: object
      required:
        - description
        - amount
        - date
        - transactionType
      properties:
        description:
          type: string
          example: Weekly offering deposit
        amount:
          type: number
          example: 4250
        date:
          type: string
          format: date
          example: '2026-07-01'
        transactionType:
          type: string
          enum:
            - DEPOSIT
            - WITHDRAWAL
            - TRANSFER
            - ADJUSTMENT
          example: DEPOSIT
        referenceNumber:
          type: string
          example: DEP-2026-0701
        fundId:
          type: string
        vendorId:
          type: string
    Transaction:
      type: object
      properties:
        id:
          type: string
        description:
          type: string
        amount:
          type: number
        date:
          type: string
          format: date-time
        transactionType:
          type: string
          enum:
            - DEPOSIT
            - WITHDRAWAL
            - TRANSFER
            - ADJUSTMENT
        referenceNumber:
          type: string
          nullable: true
        fundId:
          type: string
          nullable: true
        vendorId:
          type: string
          nullable: true
        isReconciled:
          type: boolean
    Error:
      type: object
      required:
        - message
      properties:
        message:
          type: string
          example: You do not have access to this organization.
  securitySchemes:
    GrainOAuth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://app.grainledger.com/oauth/authorize
          tokenUrl: https://api.grainledger.com/oauth/token
          scopes:
            openid: OpenID Connect
            email: Email address
            profile: Profile information
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: OAuth access token (JWT)

````