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

# Drive the claim release-engine: release a PENDING_PROOF proto-wallet's LOCKED promo grants

> Drives the claim release engine, which converts a registered customer's `LOCKED` cashback-class promotional grants into spendable promo balance. The claim is modeled as a state-machine resource: an idempotent `POST` advances each eligible grant. The engine loads the resolved customer's pending grants, applies the claim-gate policy, flips `LOCKED` (and `PENDING`) grants to `RELEASED`, and credits the resulting promo balance in a single atomic operation. Release is **gated on a verified customer**: a `LOCKED` grant is never released by an anonymous-to-identity merge alone, only by proof-of-phone verification plus claim-gate satisfaction. Resolve the customer by `wallet_user_id` or by an identity credential.\n\nThis path converges across the six possible event orderings of (register, top-up or cashback accrual, claim): register-before-accrual and accrual-before-register both converge to the same released balance, claim-after-clawback releases `0`, a duplicate claim is a no-op replay, and concurrent claims collapse to exactly one creditor (atomically, one creditor). Verification of phone ownership invokes this engine inline for the common path; this explicit endpoint exists for operational re-drive and for the top-up-before-register ordering, where verification already happened but a later accrual still needs releasing. Idempotent on the `Idempotency-Key` header: a retry replays the original result. Cross-tenant targets resolve to `FORBIDDEN` (`403`) or `NOT_FOUND` (`404`).



## OpenAPI

````yaml /api-reference/openapi.yaml post /claims
openapi: 3.1.0
info:
  title: Feddi Partner API
  version: '2026-06-01'
  description: >-
    Operate a Feddi closed-loop wallet and loyalty program at the point of sale:
    identify customers, read balances, accept wallet payments, run top-ups, and
    reconcile transactions.


    All amounts are integer minor units with an explicit ISO-4217 currency.
    Balances are merchant-held and closed-loop.


    Every response uses a typed envelope (`ok` / `data` / `error` / `meta`) with
    string error codes (never a bare HTTP number) and an idempotency-replay
    flag. Authenticate with the `x-api-key` header; exchange it for a
    short-lived POS terminal JWT for hot-path calls.


    Self-validate against this document (`GET /openapi`) and read `GET
    /capabilities` for the credential types, currencies, and features enabled
    for your integration before assuming any enum.


    Operations are tagged `x-feddi-availability: ga` (stable) or `beta`
    (callable, contract may still change additively); confirm what is enabled
    for your credentials via `GET /capabilities`.


    Sandbox access is granted per partner agreement; request credentials from
    your Feddi contact.
servers:
  - url: https://api.feddi.io/v1/partner
    description: production
  - url: https://api.dev.feddi.io/v1/partner
    description: dev
security:
  - ApiKeyAuth: []
tags:
  - name: platform
    description: >-
      Platform cross-cutting: health, capabilities, openapi self-serve, merchant
      provisioning, settlement, reconciliation.
  - name: checkout_session
    description: >-
      Checkout sessions: every interaction opens a session, then identity and
      basket attach to it, and payment, top-up, and offers run against it.
  - name: auth
    description: >-
      Partner authentication + onboarding: API key lifecycle, POS terminal JWT
      exchange, terminal heartbeat.
  - name: customers
    description: >-
      Customer lookup + identification: resolve identity, cashier-panel
      summaries, preferences, GDPR export/erase.
  - name: enrollment
    description: >-
      Enrollment + signup: OTP enroll, cashback claims, identity/consent,
      customer correction + merge.
  - name: payments
    description: >-
      Payments + redemption: debit wallet (promo-first), balance-check, void,
      refund, QR mint.
  - name: topup
    description: >-
      Wallet top-up: 2-step prepare/confirm, reload-bonus grants, SKU top-up,
      settlement + reconciliation.
  - name: incentives
    description: >-
      Incentives + offers: offer feeds, apply/redeem/release locks, proposals,
      budget envelopes, points, grant clawback.
  - name: transactions
    description: >-
      Transactions + receipts: transaction detail, void, receipts, disputes,
      settlements, reconciliation, exports.
  - name: webhooks
    description: >-
      Webhooks + events: subscriptions, delivery history + retry, event catalog,
      polling fallback.
paths:
  /claims:
    post:
      tags:
        - enrollment
      summary: >-
        Drive the claim release-engine: release a PENDING_PROOF proto-wallet's
        LOCKED promo grants
      description: >-
        Drives the claim release engine, which converts a registered customer's
        `LOCKED` cashback-class promotional grants into spendable promo balance.
        The claim is modeled as a state-machine resource: an idempotent `POST`
        advances each eligible grant. The engine loads the resolved customer's
        pending grants, applies the claim-gate policy, flips `LOCKED` (and
        `PENDING`) grants to `RELEASED`, and credits the resulting promo balance
        in a single atomic operation. Release is **gated on a verified
        customer**: a `LOCKED` grant is never released by an
        anonymous-to-identity merge alone, only by proof-of-phone verification
        plus claim-gate satisfaction. Resolve the customer by `wallet_user_id`
        or by an identity credential.\n\nThis path converges across the six
        possible event orderings of (register, top-up or cashback accrual,
        claim): register-before-accrual and accrual-before-register both
        converge to the same released balance, claim-after-clawback releases
        `0`, a duplicate claim is a no-op replay, and concurrent claims collapse
        to exactly one creditor (atomically, one creditor). Verification of
        phone ownership invokes this engine inline for the common path; this
        explicit endpoint exists for operational re-drive and for the
        top-up-before-register ordering, where verification already happened but
        a later accrual still needs releasing. Idempotent on the
        `Idempotency-Key` header: a retry replays the original result.
        Cross-tenant targets resolve to `FORBIDDEN` (`403`) or `NOT_FOUND`
        (`404`).
      operationId: claimsRelease
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ClaimRequest'
            example:
              meta:
                partner_request_id: 4d5e6f70-0004-4f9b-9d1e-1a2b3c4d5e6f
                occurred_at: '2026-06-05T09:55:00Z'
                sent_at: '2026-06-05T09:55:00Z'
                api_version: '2026-06-01'
              context:
                merchant_id: 11111111-1111-1111-1111-111111111111
                branch_id: 22222222-2222-2222-2222-222222222222
              wallet_user_id: wu_aa01
              customer: null
      responses:
        '200':
          description: >-
            Claim resolved, eligible LOCKED grants released and credited (or
            idempotent replay; or 0 released when nothing was claimable / all
            clawed back).
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/ResponseEnvelope'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/ClaimResult'
              example:
                ok: true
                data:
                  claim_id: clm_01
                  wallet_user_id: wu_aa01
                  state: released
                  customer_state: verified
                  wallet_id: wal_5512
                  released_minor: 250
                  promo_balance_after_minor: 250
                  currency: QAR
                  released_grants:
                    - promo_grant_id: pg_bb02
                      released_minor: 250
                      source: SKU_TOPUP_BONUS
                      state: RELEASED
                      expires_at: '2026-09-05T00:00:00Z'
                  skipped_grants: []
                error: null
                meta:
                  request_id: req_cl1
                  idempotency_replayed: false
                  api_version: '2026-06-01'
                  data_completeness_score: 80
                  decision_trace_id: dt_claim_7af2
        '400':
          description: >-
            `VALIDATION_ERROR` (HTTP 400), malformed body, neither
            `wallet_user_id` nor `customer` supplied, or a domain rule violated.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/ResponseEnvelope'
                  - type: object
                    properties:
                      error:
                        $ref: '#/components/schemas/Error'
        '401':
          description: >-
            `INVALID_API_KEY` (HTTP 401), missing/invalid `x-api-key` or POS
            terminal JWT.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/ResponseEnvelope'
                  - type: object
                    properties:
                      error:
                        $ref: '#/components/schemas/Error'
        '403':
          description: >-
            `FORBIDDEN` (HTTP 403), the customer / grant belongs to another
            integration (cross-tenant), or the customer is not VERIFIED so the
            claim-gate denies release.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/ResponseEnvelope'
                  - type: object
                    properties:
                      error:
                        $ref: '#/components/schemas/Error'
        '404':
          description: >-
            `NOT_FOUND`, no wallet identity for the identity in this integration
            (also the cross-tenant response).
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/ResponseEnvelope'
                  - type: object
                    properties:
                      error:
                        $ref: '#/components/schemas/Error'
        '422':
          description: >-
            `IDEMPOTENCY_KEY_REUSED` (same key, different payload) or
            `WALLET_PROGRAM_AMBIGUOUS` (identity maps to multiple programs;
            candidates listed).
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/ResponseEnvelope'
                  - type: object
                    properties:
                      error:
                        $ref: '#/components/schemas/Error'
      security:
        - PosTerminalJWT: []
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: true
      description: >-
        Partner-generated UUID; the ONE dedup key for all mutating endpoints.
        24h TTL. Same key + same payload -> byte-identical replay; same key +
        different payload -> IDEMPOTENCY_KEY_REUSED (422).
      schema:
        type: string
        format: uuid
  schemas:
    ClaimRequest:
      type: object
      description: >-
        Body for POST /claims. Resolve the customer by wallet_user_id OR
        identity credential (at least one required).
      required:
        - context
      properties:
        meta:
          $ref: '#/components/schemas/RequestMeta'
        context:
          $ref: '#/components/schemas/RequestContext'
        wallet_user_id:
          type:
            - string
            - 'null'
          description: The VERIFIED wallet identity whose LOCKED grants to release.
        customer:
          $ref: '#/components/schemas/CustomerCredential'
    ResponseEnvelope:
      type: object
      description: >-
        The standard response envelope that every enveloped endpoint serializes
        through. `ok` is a boolean discriminator: when `ok` is `true`, the typed
        result is carried in `data`; when `ok` is `false`, a typed error object
        is returned instead. The `meta` object is uniform across the entire API
        surface.
      required:
        - ok
        - meta
      properties:
        ok:
          type: boolean
        data:
          type:
            - object
            - 'null'
        error:
          oneOf:
            - $ref: '#/components/schemas/Error'
            - type: 'null'
        meta:
          $ref: '#/components/schemas/Meta'
    ClaimResult:
      type: object
      description: >-
        State of the claim resource. `state` is the claim-state-machine value;
        the grant breakdown shows what released vs was skipped (e.g. clawed-back
        / not-yet-verified).
      required:
        - claim_id
        - wallet_user_id
        - state
      properties:
        claim_id:
          type: string
          format: uuid
        wallet_user_id:
          type: string
        state:
          type: string
          enum:
            - pending
            - released
            - expired
            - clawed_back
          description: >-
            pending=awaiting verify/gate; released=grants credited;
            expired=grants lapsed before claim; clawed_back=grants were reversed
            before claim (releases 0).
        customer_state:
          type:
            - string
            - 'null'
          enum:
            - verified
            - pending_proof
            - null
        wallet_id:
          type:
            - string
            - 'null'
        released_minor:
          type: integer
          description: >-
            Total promo released by this claim (0 when nothing was claimable),
            minor units.
        promo_balance_after_minor:
          type:
            - integer
            - 'null'
        currency:
          type:
            - string
            - 'null'
        released_grants:
          type: array
          items:
            $ref: '#/components/schemas/ReleasedGrant'
        skipped_grants:
          type: array
          description: >-
            Grants NOT released, with a reason (already_clawed_back / expired /
            gate_not_met).
          items:
            type: object
            required:
              - promo_grant_id
              - reason
            properties:
              promo_grant_id:
                type: string
              reason:
                type: string
                enum:
                  - already_clawed_back
                  - expired
                  - gate_not_met
                  - already_released
    Error:
      type: object
      description: >-
        The typed error object returned with every non-2xx response. `code` is a
        string enum (for example `WALLET_PROGRAM_AMBIGUOUS`,
        `CREDENTIAL_TYPE_UNSUPPORTED`, `INSUFFICIENT_FUNDS`,
        `IDEMPOTENCY_KEY_REUSED`, `CURRENCY_NOT_SUPPORTED`), **never a bare HTTP
        status number**. Inspect `code` for programmatic branching, not the HTTP
        status. Some codes echo the valid set in `details` so clients can
        present or reconcile the accepted values: for example
        `CREDENTIAL_TYPE_UNSUPPORTED` lists the supported credential types,
        `CURRENCY_NOT_SUPPORTED` lists the supported ISO-4217 currencies, and
        `WALLET_PROGRAM_AMBIGUOUS` lists the candidate `wallet_program_id`
        values that matched the request.
      required:
        - code
        - message
      properties:
        code:
          type: string
          enum:
            - INSUFFICIENT_FUNDS
            - INVALID_API_KEY
            - CREDENTIAL_TYPE_UNSUPPORTED
            - CURRENCY_NOT_SUPPORTED
            - IDEMPOTENCY_KEY_REUSED
            - WALLET_PROGRAM_AMBIGUOUS
            - REQUIRES_DYNAMIC_CREDENTIAL
            - NOT_FOUND
            - FORBIDDEN
            - VALIDATION_ERROR
            - RATE_LIMITED
            - CONFLICT
            - INTERNAL_SERVER_ERROR
        message:
          type: string
        details:
          type: object
          additionalProperties: true
    RequestMeta:
      type: object
      description: >-
        Common request metadata shared across all Partner API domains.
        `partner_request_id` is a correlation identifier only: it appears in
        logs and responses for tracing but is **never used as the deduplication
        key**. Request deduplication is keyed exclusively on the
        `Idempotency-Key` header.
      required:
        - partner_request_id
        - api_version
      properties:
        partner_request_id:
          type: string
          format: uuid
          description: Partner's own correlation id. NOT the idempotency basis.
        occurred_at:
          type: string
          format: date-time
          description: >-
            When the event happened at the POS (RFC3339). Clock-drift signal vs
            sent_at.
        sent_at:
          type: string
          format: date-time
          description: When the partner sent the request (RFC3339).
        api_version:
          type: string
          description: The single API version field.
          example: '2026-06-01'
    RequestContext:
      type: object
      description: >-
        Canonical request context, shared across all partner domains.
        `merchant_id` is key-enforced to a merchant the calling credential is
        authorized for (a platform-scoped credential acts only on its own
        tenants), so it is **never a free-text trust field**: a `merchant_id`
        outside the credential's authority is rejected rather than honored.
      required:
        - merchant_id
      properties:
        merchant_id:
          type: string
          format: uuid
          description: Resolved Feddi tenant (enterprise).
        branch_id:
          type:
            - string
            - 'null'
          format: uuid
        terminal_id:
          type:
            - string
            - 'null'
        cashier_id:
          type:
            - string
            - 'null'
          description: Server-trusted only when signed into the terminal JWT.
        partner_session_id:
          type:
            - string
            - 'null'
          description: The partner's own order/session ref.
        feddi_session_id:
          type:
            - string
            - 'null'
          format: uuid
          description: >-
            The checkout_session this call anchors to. On session sub-resource
            calls it is redundant with the path `{id}` and must match it.
    CustomerCredential:
      type: object
      description: >-
        An identity credential used to resolve a customer, shared across all
        partner domains. The object is discriminated by `credential_type`, and
        the value field matching the declared `credential_type` is REQUIRED
        (enforced by per-type conditional schemas: a credential without its
        matching value field is invalid). The set of supported `credential_type`
        values is enumerated by `GET /capabilities`. New credential types are
        added additively: a new type appears in the `GET /capabilities` set
        without any route change. A `credential_type` that is not in the
        supported set returns `CREDENTIAL_TYPE_UNSUPPORTED`, and the error
        response lists the currently supported set.
      required:
        - credential_type
      properties:
        credential_type:
          type: string
          enum:
            - phone
            - provider_customer_id
            - card_fingerprint
            - short_code
            - qr
          description: >-
            Which credential identifies the customer. phone=Feddi-native;
            provider_customer_id=the POS provider's customer id;
            card_fingerprint=masked-PAN hash (probationary until
            phone-verified); short_code=wallet-minted code; qr=raw QR payload
            scanned from the wallet app. The enabled set is gated by GET
            /capabilities.
        phone:
          type:
            - string
            - 'null'
          description: E.164 phone (when credential_type=phone).
        provider_customer_id:
          type:
            - string
            - 'null'
          description: >-
            The POS provider's customer id (when
            credential_type=provider_customer_id).
        card_fingerprint:
          type:
            - string
            - 'null'
          description: >-
            Masked-PAN hash (when credential_type=card_fingerprint).
            PROBATIONARY identity, reversible until phone-verified; never
            auto-acts on money.
        short_code:
          type:
            - string
            - 'null'
          description: Wallet-minted short code (when credential_type=short_code).
        qr:
          type:
            - string
            - 'null'
          description: >-
            Raw QR payload scanned from the wallet app (when
            credential_type=qr).
      allOf:
        - if:
            required:
              - credential_type
            properties:
              credential_type:
                const: phone
          then:
            required:
              - phone
            properties:
              phone:
                type: string
        - if:
            required:
              - credential_type
            properties:
              credential_type:
                const: provider_customer_id
          then:
            required:
              - provider_customer_id
            properties:
              provider_customer_id:
                type: string
        - if:
            required:
              - credential_type
            properties:
              credential_type:
                const: card_fingerprint
          then:
            required:
              - card_fingerprint
            properties:
              card_fingerprint:
                type: string
        - if:
            required:
              - credential_type
            properties:
              credential_type:
                const: short_code
          then:
            required:
              - short_code
            properties:
              short_code:
                type: string
        - if:
            required:
              - credential_type
            properties:
              credential_type:
                const: qr
          then:
            required:
              - qr
            properties:
              qr:
                type: string
    Meta:
      type: object
      description: >-
        The uniform response metadata block returned on every response.
        `data_completeness_score` is computed per call and reports the
        completeness of the returned data. `decision_trace_id` is present on
        responses that carry decision or insight output and can be used to
        correlate the response with its reasoning. `capabilities` is an
        additive, response-level array of hints advertising features the caller
        may use, and may be extended over time without notice.
      required:
        - request_id
        - api_version
      properties:
        request_id:
          type: string
          description: Feddi-issued correlation id for this response.
        idempotency_replayed:
          type: boolean
          description: True when this response was replayed from the idempotency store.
        api_version:
          type: string
          description: The single API version field.
          example: '2026-06-01'
        data_completeness_score:
          type: integer
          minimum: 0
          maximum: 100
          description: >-
            0-100, computed per call (basket/identity/tax/category/consent
            presence).
        decision_trace_id:
          type:
            - string
            - 'null'
          description: Opaque trace id on intelligence-bearing responses; one per response.
        capabilities:
          type: object
          additionalProperties: true
          description: Additive response-level capability hints.
    ReleasedGrant:
      type: object
      description: >-
        A single promotional grant released (or carried forward) as the result
        of a claim or verify operation. Promotional balances can expire and are
        **never cashable**: they may only be spent, not withdrawn or refunded as
        cash.
      required:
        - promo_grant_id
        - released_minor
      properties:
        promo_grant_id:
          type: string
          description: The promotional grant ledger row id.
        released_minor:
          type: integer
          description: Promo amount released to spendable, minor units.
        source:
          type:
            - string
            - 'null'
          enum:
            - CASHBACK
            - RELOAD_BONUS
            - SKU_TOPUP_BONUS
            - GATEWAY_BONUS
            - SIGNUP_BONUS
            - null
          description: Which lane accrued this grant.
        state:
          type:
            - string
            - 'null'
          enum:
            - LOCKED
            - RELEASED
            - CLAWED_BACK
            - EXPIRED
            - null
          description: Resulting grant state (same casing as promotional grant.state`).
        expires_at:
          type:
            - string
            - 'null'
          format: date-time
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Partner API key (platform- or merchant-scoped). Contract key-enforces
        context.merchant_id.
    PosTerminalJWT:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        POS terminal JWT minted by /auth/token; carries integrationId +
        terminal/cashier claims (server-trusted).

````