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

# Mark a claim's reward code used

> For the partner honouring the code, so the same code cannot be applied twice: it sets `code_used_at` once, and a second call is refused. Call it before you charge. Send an `Idempotency-Key` tied to one checkout attempt to make a retry of that attempt replay the original response. Member sessions are refused.



## OpenAPI

````yaml https://api.develop.fourdos.dev/openapi/partner.json post /v1/users/{userId}/redemptions/{redemptionId}/use
openapi: 3.1.0
info:
  title: 4D OS Partner API
  version: 0.1.0
  description: >-
    REST API for 4D OS partners. Authenticate with your organization API key:
    `Authorization: Bearer <key>`.


    Requests and responses are JSON with `snake_case` field names. Errors share
    one envelope: `{ "error": { "code", "status", "message", "details"? } }`.


    Mutating endpoints that declare it accept an `Idempotency-Key` header so
    retries are safe.


    Bulk-migrating members? See the [Migrating to 4D
    guide](https://docs.fourdos.dev/walkthroughs/migrate-existing-members) for
    the canonical import schema, a worked example, and the `/v1/imports`
    sequence.
servers:
  - url: https://api.develop.fourdos.dev
security:
  - partnerApiKey: []
tags:
  - name: Users
    description: Create, read, and manage users and their org membership
  - name: Imports
    description: Bulk member import jobs (staging → validate → commit)
  - name: Consents
    description: Record, list and withdraw a member's consents and agreements
  - name: Rewards
    description: A member's reward catalog, claims and reward codes
  - name: XP
    description: >-
      A member's balance, earning headroom, expiry and boosts, and what each
      event pays
  - name: Tiers
    description: Read your organization's tier ladder
  - name: Webhooks
    description: Register webhook endpoints. Deliveries are not sent yet.
  - name: Events
    description: Refetch your organization's events from the last 30 days
  - name: API keys
    description: Issue, list, and revoke server-side organization API keys
  - name: Modules
    description: >-
      Publish private modules, install visible modules, and manage their
      credentials
  - name: Ingest
    description: Receive signed native events from an installed module
  - name: Engagement
    description: Browser event tracking (publishable keys) and tracking-key management
  - name: Revenue
    description: Report sales and refunds for the club's revenue dashboards
  - name: Ad delivery
    description: Fill a club site's ad slots, for anonymous or signed-in fans
  - name: Ad entries
    description: Fans entering a sponsor's draw, reported by the club's backend
paths:
  /v1/users/{userId}/redemptions/{redemptionId}/use:
    post:
      tags:
        - Rewards
      summary: Mark a claim's reward code used
      description: >-
        For the partner honouring the code, so the same code cannot be applied
        twice: it sets `code_used_at` once, and a second call is refused. Call
        it before you charge. Send an `Idempotency-Key` tied to one checkout
        attempt to make a retry of that attempt replay the original response.
        Member sessions are refused.
      operationId: useRedemptionCode
      parameters:
        - name: userId
          in: path
          required: true
          schema:
            type: string
        - name: redemptionId
          in: path
          required: true
          schema:
            type: string
        - name: Idempotency-Key
          in: header
          required: false
          description: >-
            Optional. The same key for the same claim replays the original
            response.
          schema:
            type: string
      responses:
        '200':
          description: The claim with `code_used_at` set
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Redemption'
        '401':
          description: '`UNAUTHORIZED`: no valid credential'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: >-
            `FORBIDDEN`: the caller is a member session. `CONSENT_REQUIRED`: an
            admin session still owes an agreement (`details.scopes`)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: '`NOT_FOUND`: no such claim for this member in your organization'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >-
            `REWARD_CODE_USED`: the code was already marked used
            (`details.code_used_at`). `IDEMPOTENCY_CONFLICT`: the key was
            already used for a different request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: '`VALIDATION_ERROR`: the claim''s reward issued no code'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - partnerApiKey: []
        - adminSession: []
components:
  schemas:
    Redemption:
      type: object
      properties:
        id:
          type: string
        user_id:
          type: string
        org_id:
          type: string
        reward_id:
          type: string
        amount:
          type: string
          description: A non-negative integer as a decimal string.
        status:
          type: string
          enum:
            - pending
            - burned
            - fulfilled
            - failed
        burn_ledger_entry_id:
          type:
            - string
            - 'null'
        onchain_job_id:
          type:
            - string
            - 'null'
        fulfilled_at:
          type:
            - string
            - 'null'
          format: date-time
        code:
          type:
            - string
            - 'null'
          description: >-
            The single-use code a code reward issued; null for every other
            reward.
        code_used_at:
          type:
            - string
            - 'null'
          format: date-time
          description: Null while the code is still usable.
        created_at:
          type: string
          format: date-time
      required:
        - id
        - user_id
        - org_id
        - reward_id
        - amount
        - status
        - burn_ledger_entry_id
        - onchain_job_id
        - fulfilled_at
        - code
        - code_used_at
        - created_at
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            status:
              type: integer
            message:
              type: string
            details:
              type: object
              additionalProperties: true
          required:
            - code
            - status
            - message
      required:
        - error
  securitySchemes:
    partnerApiKey:
      type: http
      scheme: bearer
      description: >-
        Organization API key (`org_...`) sent as `Authorization: Bearer <key>`.
        Keys are scoped to one organization; every request operates within that
        tenant.
    adminSession:
      type: http
      scheme: bearer
      description: >-
        Partner admin session token sent as `Authorization: Bearer <token>`.
        Obtained by signing in (console or the email OTP endpoints) and
        completing the second factor; see the Authentication page.

````

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