> ## 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 contribution

> Use Idempotency-Key for duplicate-safe retries. The same key and validated input return the existing contribution (201); different input or a deleted original returns 409. Keys are scoped to organization and OAuth application, API key, or unmanaged OAuth user. External IDs alone do not deduplicate split gifts.



## OpenAPI

````yaml /openapi.json post /api/v1/contributions
openapi: 3.0.3
info:
  title: Grain API
  description: >-
    Church accounting and donor management API. Use an organization API key for
    server automation or OAuth 2.1 (Sign in with Grain) for applications acting
    on behalf of users. Unmanaged OAuth requests require X-Organization-Id;
    Grain-managed OAuth apps may list authorized organizations first. API keys
    infer the organization.
  version: 1.3.0
servers:
  - url: https://api.grainledger.com
    description: API Server
security:
  - ApiKeyAuth: []
  - GrainOAuth2: []
  - BearerAuth: []
tags:
  - name: Funds
    description: Active funds available for integration mapping
  - name: Coding Reference Data
    description: Accounts, dimensions, and vendors used to code transactions
  - name: Transactions
    description: Bank transactions, coding, approval, and receipts
  - 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: Giving Batches
    description: Contribution groups with derived totals and lifecycle state
  - name: Settlements
    description: Provider deposits with recorded and linked-contribution totals
  - name: Pledges
    description: Pledge campaigns and fulfillment tracking
  - name: Pledge Card Imports
    description: Submit structured pledge card data for review
  - name: Households
    description: Household groupings and primary contacts
  - name: Organizations
    description: Organizations the current Grain OAuth app is authorized to access
paths:
  /api/v1/contributions:
    post:
      tags:
        - Contributions
      summary: Create contribution
      description: >-
        Use Idempotency-Key for duplicate-safe retries. The same key and
        validated input return the existing contribution (201); different input
        or a deleted original returns 409. Keys are scoped to organization and
        OAuth application, API key, or unmanaged OAuth user. External IDs alone
        do not deduplicate split gifts.
      parameters:
        - $ref: '#/components/parameters/OrganizationId'
        - name: Idempotency-Key
          in: header
          required: false
          description: >-
            Stable key for one contribution create, retained for the lifetime of
            the organization. Use a distinct key per split row. Replays return
            the current representation with current permissions; they do not
            restore an earlier snapshot.
          schema:
            type: string
            minLength: 1
            maxLength: 200
            pattern: ^[!-~]+$
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateContribution'
            examples:
              check:
                value:
                  donorId: cm456def789ghi
                  amount: 250
                  date: '2026-07-06'
                  fundId: cm789ghi012jkl
                  method: CHECK
                  checkNumber: '1042'
      responses:
        '201':
          headers:
            X-Request-Id:
              description: >-
                Server-generated ID linking this request to API activity and
                audit records.
              schema:
                type: string
                format: uuid
          description: Created contribution
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Contribution'
        '400':
          headers:
            X-Request-Id:
              description: >-
                Server-generated ID linking this request to API activity and
                audit records.
              schema:
                type: string
                format: uuid
          description: Bad request (missing header or invalid input)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          headers:
            X-Request-Id:
              description: >-
                Server-generated ID linking this request to API activity and
                audit records.
              schema:
                type: string
                format: uuid
          description: Unauthorized (missing or invalid Bearer token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          headers:
            X-Request-Id:
              description: >-
                Server-generated ID linking this request to API activity and
                audit records.
              schema:
                type: string
                format: uuid
          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'
          headers:
            X-Request-Id:
              description: >-
                Server-generated ID linking this request to API activity and
                audit records.
              schema:
                type: string
                format: uuid
        '409':
          headers:
            X-Request-Id:
              description: >-
                Server-generated ID linking this request to API activity and
                audit records.
              schema:
                type: string
                format: uuid
          description: >-
            Conflict (duplicate, cross-resource ownership conflict, concurrent
            change, or accounting-frozen resource)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          headers:
            X-Request-Id:
              description: >-
                Server-generated ID linking this request to API activity and
                audit records.
              schema:
                type: string
                format: uuid
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          headers:
            X-Request-Id:
              description: >-
                Server-generated ID linking this request to API activity and
                audit records.
              schema:
                type: string
                format: uuid
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          headers:
            X-Request-Id:
              description: >-
                Server-generated ID linking this request to API activity and
                audit records.
              schema:
                type: string
                format: uuid
components:
  parameters:
    OrganizationId:
      name: X-Organization-Id
      in: header
      required: false
      schema:
        type: string
      description: >-
        Required with OAuth access tokens for resource requests. Omit only for
        GET /api/v1/organizations. Optional with organization API keys; if
        supplied with an API key, it must match the key's organization.
      example: cm123abc456def
  schemas:
    CreateContribution:
      type: object
      additionalProperties: false
      required:
        - amount
        - date
        - fundId
        - method
      properties:
        donorId:
          type: string
          minLength: 1
          example: cm456def789ghi
        sourceDonorId:
          type: string
          minLength: 1
        amount:
          type: number
          minimum: 0
          exclusiveMinimum: true
          example: 250
        date:
          type: string
          format: date
          example: '2026-07-06'
        fundId:
          type: string
          minLength: 1
          example: cm789ghi012jkl
        method:
          type: string
          enum:
            - CASH
            - CHECK
            - CREDIT_CARD
            - ACH
            - ONLINE
            - STOCK
            - OTHER
          example: CHECK
        checkNumber:
          type: string
          example: '1042'
          description: Required when method is CHECK.
        checkDate:
          type: string
          format: date
          nullable: true
        isTaxDeductible:
          type: boolean
          default: true
        notes:
          type: string
        memo:
          type: string
          maxLength: 2000
          nullable: true
        feeCovered:
          type: boolean
        givingBatchId:
          type: string
          minLength: 1
          nullable: true
        settlementId:
          type: string
          minLength: 1
          nullable: true
        givingMerchantId:
          type: string
          minLength: 1
          nullable: true
        externalId:
          type: string
        externalSource:
          type: string
          enum:
            - PUSHPAY
            - PLANNING_CENTER
            - CCB
            - TITHELY
            - SUBSPLASH
            - ROCK_RMS
            - OVERFLOW
            - MANUAL
            - OTHER
        externalDonorId:
          type: string
          maxLength: 500
          nullable: true
        givingEventKey:
          type: string
          minLength: 1
          maxLength: 500
          nullable: true
        processingFee:
          type: number
          minimum: 0
        netAmount:
          type: number
          minimum: 0
        paymentStatus:
          type: string
          enum:
            - PENDING
            - SUCCEEDED
            - FAILED
        paymentLast4:
          type: string
          maxLength: 4
          nullable: true
        paymentBrand:
          type: string
          maxLength: 100
          nullable: true
        paymentMethodSub:
          type: string
          maxLength: 100
          nullable: true
        paymentMethodType:
          type: string
          maxLength: 100
          nullable: true
        paymentSource:
          type: string
          maxLength: 100
          nullable: true
        isRefunded:
          type: boolean
        refundedAt:
          type: string
          format: date-time
          nullable: true
        completedAt:
          type: string
          format: date-time
          nullable: true
        sourceType:
          type: string
          enum:
            - DIRECT
            - DAF
            - QCD_IRA
            - MATCHING
            - FOUNDATION
            - ESTATE
        benefitDescription:
          type: string
          nullable: true
        benefitValue:
          type: number
          minimum: 0
          nullable: true
        deductibleAmount:
          type: number
          minimum: 0
          nullable: true
        stockTicker:
          type: string
          nullable: true
        stockShares:
          type: number
          minimum: 0
          exclusiveMinimum: true
          nullable: true
        stockFmvPerShare:
          type: number
          minimum: 0
          exclusiveMinimum: true
          nullable: true
        stockTransferDate:
          type: string
          format: date
          nullable: true
        inKindDescription:
          type: string
          nullable: true
        inKindFmv:
          type: number
          minimum: 0
          nullable: true
        inKindAppraisalDate:
          type: string
          format: date
          nullable: true
        foreignCurrency:
          type: string
          nullable: true
        foreignAmount:
          type: number
          nullable: true
        exchangeRate:
          type: number
          nullable: true
    Contribution:
      type: object
      additionalProperties: false
      description: >-
        Contribution detail with one-level resource summaries. Provider metadata
        and processor billing identity are never returned.
      required:
        - id
        - donorId
        - sourceDonorId
        - amount
        - date
        - fundId
        - method
        - isTaxDeductible
        - externalSource
        - givingBatchId
        - settlementId
        - givingMerchantId
        - processingFee
        - netAmount
        - feeCovered
        - payment
        - settlementState
        - sourceType
        - quidProQuo
        - stock
        - inKind
        - foreignCurrency
        - foreignAmount
        - exchangeRate
        - donor
        - sourceDonor
        - fund
        - batch
        - settlement
        - journalEntry
        - merchant
        - createdAt
        - updatedAt
      properties:
        id:
          type: string
        donorId:
          type: string
          nullable: true
        sourceDonorId:
          type: string
          nullable: true
        amount:
          type: number
        date:
          type: string
          format: date-time
          description: Calendar day represented as a UTC-midnight ISO timestamp.
        fundId:
          type: string
        method:
          type: string
          enum:
            - CASH
            - CHECK
            - CREDIT_CARD
            - ACH
            - ONLINE
            - STOCK
            - OTHER
        isTaxDeductible:
          type: boolean
        checkNumber:
          type: string
          nullable: true
        checkDate:
          type: string
          format: date-time
          nullable: true
          description: Calendar day represented as a UTC-midnight ISO timestamp.
        notes:
          type: string
          nullable: true
        memo:
          type: string
          nullable: true
        externalSource:
          type: string
        externalId:
          type: string
          nullable: true
        externalDonorId:
          type: string
          nullable: true
          description: >-
            Provider donor identifier. Null when the caller lacks donor identity
            access.
        givingEventKey:
          type: string
          minLength: 1
          maxLength: 500
          nullable: true
        givingBatchId:
          type: string
          nullable: true
        settlementId:
          type: string
          nullable: true
        givingMerchantId:
          type: string
          nullable: true
        processingFee:
          type: number
          nullable: true
        netAmount:
          type: number
          nullable: true
        feeCovered:
          type: boolean
        payment:
          type: object
          additionalProperties: false
          required:
            - status
            - last4
            - brand
            - methodSubtype
            - methodType
            - source
            - completedAt
            - isRefunded
            - refundedAt
          properties:
            status:
              type: string
              enum:
                - PENDING
                - SUCCEEDED
                - FAILED
            last4:
              type: string
              nullable: true
            brand:
              type: string
              nullable: true
            methodSubtype:
              type: string
              nullable: true
            methodType:
              type: string
              nullable: true
            source:
              type: string
              nullable: true
            isRefunded:
              type: boolean
            refundedAt:
              type: string
              format: date-time
              nullable: true
            completedAt:
              type: string
              format: date-time
              nullable: true
        settlementState:
          type: object
          additionalProperties: false
          readOnly: true
          required:
            - isSettled
            - settlementDate
            - settlementBatch
            - isCleared
            - clearedAt
          properties:
            isSettled:
              type: boolean
            settlementDate:
              type: string
              format: date-time
              nullable: true
            settlementBatch:
              type: string
              nullable: true
            isCleared:
              type: boolean
            clearedAt:
              type: string
              format: date-time
              nullable: true
        sourceType:
          type: string
          nullable: true
          enum:
            - DIRECT
            - DAF
            - QCD_IRA
            - MATCHING
            - FOUNDATION
            - ESTATE
        quidProQuo:
          $ref: '#/components/schemas/ContributionQuidProQuo'
        stock:
          $ref: '#/components/schemas/ContributionStock'
        inKind:
          $ref: '#/components/schemas/ContributionInKind'
        foreignCurrency:
          type: string
          nullable: true
        foreignAmount:
          type: number
          nullable: true
        exchangeRate:
          type: number
          nullable: true
        donor:
          $ref: '#/components/schemas/DonorIdentitySummary'
          nullable: true
          description: Present only with donor identity access.
        sourceDonor:
          $ref: '#/components/schemas/DonorIdentitySummary'
          nullable: true
          description: Present only with donor identity access.
        fund:
          $ref: '#/components/schemas/FundRelationshipSummary'
          nullable: true
        batch:
          $ref: '#/components/schemas/BatchRelationshipSummary'
          nullable: true
        settlement:
          $ref: '#/components/schemas/SettlementRelationshipSummary'
          nullable: true
        journalEntry:
          $ref: '#/components/schemas/JournalEntryRelationshipSummary'
          nullable: true
        merchant:
          $ref: '#/components/schemas/ContributionMerchantSummary'
          nullable: true
        createdAt:
          type: string
          format: date-time
          nullable: true
        updatedAt:
          type: string
          format: date-time
          nullable: true
    Error:
      type: object
      description: >-
        Every error response is valid JSON with this shape. The HTTP status code
        carries the outcome; `code` is a stable machine-readable form of it.
      required:
        - code
        - message
      properties:
        code:
          type: string
          enum:
            - bad_request
            - unauthorized
            - forbidden
            - not_found
            - conflict
            - unprocessable_entity
            - payload_too_large
            - rate_limited
            - internal_server_error
          example: forbidden
        message:
          type: string
          example: You do not have access to this organization.
        error:
          type: string
          deprecated: true
          description: Deprecated alias for `message`. Read `message` instead.
          example: You do not have access to this organization.
        details:
          type: object
          description: >-
            Present for schema validation failures. Contains safe top-level
            field names and validation codes, never submitted values.
          properties:
            fields:
              type: array
              maxItems: 20
              items:
                type: object
                required:
                  - field
                  - code
                properties:
                  field:
                    type: string
                    example: amount
                  code:
                    type: string
                    example: invalid_type
    ContributionQuidProQuo:
      type: object
      additionalProperties: false
      required:
        - benefitDescription
        - benefitValue
        - deductibleAmount
      properties:
        benefitDescription:
          type: string
          nullable: true
        benefitValue:
          type: number
          nullable: true
        deductibleAmount:
          type: number
          nullable: true
    ContributionStock:
      type: object
      additionalProperties: false
      required:
        - ticker
        - shares
        - fairMarketValuePerShare
        - transferDate
      properties:
        ticker:
          type: string
          nullable: true
        shares:
          type: number
          nullable: true
        fairMarketValuePerShare:
          type: number
          nullable: true
        transferDate:
          type: string
          format: date-time
          nullable: true
    ContributionInKind:
      type: object
      additionalProperties: false
      required:
        - description
        - fairMarketValue
        - appraisalDate
      properties:
        description:
          type: string
          nullable: true
        fairMarketValue:
          type: number
          nullable: true
        appraisalDate:
          type: string
          format: date-time
          nullable: true
    DonorIdentitySummary:
      type: object
      additionalProperties: false
      required:
        - id
        - firstName
        - lastName
        - organizationName
        - donorType
      properties:
        id:
          type: string
        firstName:
          type: string
          nullable: true
        lastName:
          type: string
          nullable: true
        organizationName:
          type: string
          nullable: true
        donorType:
          type: string
          nullable: true
    FundRelationshipSummary:
      type: object
      additionalProperties: false
      required:
        - id
        - name
        - fundType
      properties:
        id:
          type: string
        name:
          type: string
        fundType:
          type: string
          nullable: true
    BatchRelationshipSummary:
      type: object
      additionalProperties: false
      required:
        - id
        - externalReference
        - batchDate
        - status
        - totalGross
        - totalFees
        - totalNet
        - donationCount
      properties:
        id:
          type: string
        externalReference:
          type: string
        batchDate:
          type: string
          format: date-time
        status:
          type: string
        totalGross:
          type: number
        totalFees:
          type: number
        totalNet:
          type: number
        donationCount:
          type: integer
    SettlementRelationshipSummary:
      type: object
      additionalProperties: false
      required:
        - id
        - provider
        - externalReference
        - estimatedArrivalDate
        - status
        - totalNet
      properties:
        id:
          type: string
        provider:
          type: string
        externalReference:
          type: string
          nullable: true
        estimatedArrivalDate:
          type: string
          format: date-time
        status:
          type: string
        totalNet:
          type: number
    JournalEntryRelationshipSummary:
      type: object
      additionalProperties: false
      required:
        - id
        - entryNumber
        - referenceNumber
      properties:
        id:
          type: string
        entryNumber:
          type: string
          nullable: true
        referenceNumber:
          type: string
          nullable: true
    ContributionMerchantSummary:
      type: object
      additionalProperties: false
      required:
        - id
        - name
        - campus
        - dimensionValue
      properties:
        id:
          type: string
        name:
          type: string
        campus:
          $ref: '#/components/schemas/NamedResourceSummary'
          nullable: true
        dimensionValue:
          $ref: '#/components/schemas/NamedResourceSummary'
          nullable: true
    NamedResourceSummary:
      type: object
      additionalProperties: false
      required:
        - id
        - name
      properties:
        id:
          type: string
        name:
          type: string
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: grain_live_… or grain_test_…
      description: >-
        Organization API key created in Grain Settings → API. The key determines
        the organization and is limited to its assigned resource scopes. Write
        scopes imply the corresponding read scope.
    GrainOAuth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://auth.grainledger.com/auth/v1/oauth/authorize
          tokenUrl: https://auth.grainledger.com/auth/v1/oauth/token
          scopes:
            openid: OpenID Connect
            email: Email address
            profile: Profile information
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: OAuth access token (JWT)

````

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