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

# Record a remittance

> Allocates payer remittance to adjudicated Claims. Requires `remittances:write`.



## OpenAPI

````yaml /openapi/heyrafiki.openapi.yaml post /remittances
openapi: 3.1.0
info:
  title: Heyrafiki API
  version: 1.0.0
  description: Build Care, Cover and Payment workflows on Heyrafiki.
  contact:
    name: Heyrafiki
    url: https://heyrafiki.space
    email: developers@heyrafiki.space
  license:
    name: All rights reserved
    identifier: LicenseRef-Heyrafiki-Proprietary
servers:
  - url: https://api.heyrafiki.space/v1
security:
  - bearerAuth: []
  - apiKeyAuth: []
paths:
  /remittances:
    post:
      summary: Record a remittance
      description: >-
        Allocates payer remittance to adjudicated Claims. Requires
        `remittances:write`.
      operationId: createRemittance
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RemittanceInput'
      responses:
        '201':
          description: The remittance was reconciled
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Remittance'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/Unprocessable'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: true
      description: A caller-owned key for safely retrying one write.
      schema:
        type: string
        minLength: 8
        maxLength: 255
  schemas:
    RemittanceInput:
      type: object
      additionalProperties: false
      required:
        - payer_reference
        - currency
        - received_at
        - allocations
      properties:
        payer_reference:
          type: string
          minLength: 3
          maxLength: 200
        currency:
          type: string
          enum:
            - KES
            - USD
            - EUR
            - GBP
        received_at:
          type: string
          format: date-time
        allocations:
          type: array
          minItems: 1
          maxItems: 100
          items:
            $ref: '#/components/schemas/RemittanceAllocationInput'
    Remittance:
      type: object
      additionalProperties: false
      required:
        - id
        - object
        - status
        - payer_reference
        - amount
        - allocations
        - received_at
        - reconciled_at
      properties:
        id:
          type: string
          pattern: ^rem_[A-Za-z0-9_-]+$
        object:
          type: string
          const: remittance
        status:
          type: string
          enum:
            - received
            - reconciled
            - exception
        payer_reference:
          type: string
        amount:
          type: object
          additionalProperties: false
          required:
            - currency
            - paid
          properties:
            currency:
              type: string
              pattern: ^[A-Z]{3}$
            paid:
              type: integer
              minimum: 1
        allocations:
          type: array
          items:
            $ref: '#/components/schemas/RemittanceAllocation'
        received_at:
          type: string
          format: date-time
        reconciled_at:
          type:
            - string
            - 'null'
          format: date-time
    RemittanceAllocationInput:
      type: object
      additionalProperties: false
      required:
        - claim_id
        - paid_amount
      properties:
        claim_id:
          type: string
          pattern: ^clm_[A-Za-z0-9_-]+$
        paid_amount:
          type: integer
          minimum: 1
          maximum: 9007199254740991
        reason_codes:
          type: array
          maxItems: 16
          default: []
          items:
            type: string
            pattern: ^[a-z0-9_]+$
    RemittanceAllocation:
      type: object
      additionalProperties: false
      required:
        - claim_id
        - paid_amount
        - reason_codes
      properties:
        claim_id:
          type: string
          pattern: ^clm_[A-Za-z0-9_-]+$
        paid_amount:
          type: integer
          minimum: 1
          maximum: 9007199254740991
        reason_codes:
          type: array
          maxItems: 16
          items:
            type: string
            pattern: ^[a-z0-9_]+$
    ErrorEnvelope:
      type: object
      additionalProperties: false
      required:
        - error
      properties:
        error:
          type: object
          additionalProperties: false
          required:
            - code
            - message
            - docs
          properties:
            code:
              type: string
            message:
              type: string
            docs:
              type: string
              format: uri
  responses:
    BadRequest:
      description: The request failed validation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    Unauthorized:
      description: The API key is missing or invalid.
      headers:
        WWW-Authenticate:
          schema:
            type: string
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    Forbidden:
      description: The API key does not permit this operation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    NotFound:
      description: The requested resource does not exist or is not visible to this project.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    Conflict:
      description: The request conflicts with current state.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    Unprocessable:
      description: The request is valid but cannot be completed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    TooManyRequests:
      description: The project exceeded its request limit.
      headers:
        Retry-After:
          description: Seconds until another request should be attempted.
          schema:
            type: integer
        X-RateLimit-Limit:
          $ref: '#/components/headers/RateLimitLimit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/RateLimitRemaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/RateLimitReset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    ServiceUnavailable:
      description: The service is temporarily unavailable.
      headers:
        Retry-After:
          schema:
            type: integer
            example: 5
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
  headers:
    RateLimitLimit:
      description: Maximum requests allowed in the current minute.
      schema:
        type: integer
    RateLimitRemaining:
      description: Requests remaining in the current minute.
      schema:
        type: integer
    RateLimitReset:
      description: Unix timestamp when the current limit resets.
      schema:
        type: integer
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: A sandbox or production secret key.
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: An alternative for clients that cannot set Authorization.

````