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

# Credit Z$ to a user

> Credits `quantity` units of one of your campaigns' action to the user the identifiers point at — found, or created once, never duplicated. **201** a new credit; **200** an identical replay of the same `external_reference` (the same credit is returned, nothing is credited twice). Refusals are `application/problem+json` with a stable `error_code`. Scope `partner.credit`.



## OpenAPI

````yaml /api-reference/openapi.json post /api/v2/partner/credits/
openapi: 3.0.3
info:
  title: Zupy API v2
  version: 2.0.0
  description: >-
    Zupy API v2 — versioned, gateway-aware API with envelope responses, RFC 7807
    errors, and multi-auth support (JWT, API Key, Device Key).
servers:
  - url: https://api.zupy.com
    description: Production
security: []
tags:
  - name: Authentication
    description: OTP request and verification endpoints
  - name: Customers
    description: Customer management, points, history, and data operations
  - name: Loyalty Programs
    description: Loyalty program configuration and details
  - name: Rewards
    description: Loyalty reward catalog (definitions redeemed with points)
  - name: Companies
    description: Company information and loyalty configuration
  - name: Coupons
    description: >-
      Issued coupons (RewardRedemption) — both loyalty-reward redemptions and
      marketing claims
  - name: Wallet
    description: Apple Wallet pass generation and notifications
  - name: Webhooks
    description: Partner integration webhook endpoints
  - name: Webhook Management
    description: Configure and test outbound webhook delivery
  - name: Partner
    description: >-
      Issuer partner API: credit and transfer Z$ with your partner key (scopes
      `partner.read`, `partner.credit`, `partner.transfer`).
paths:
  /api/v2/partner/credits/:
    post:
      tags:
        - Partner
      summary: Credit Z$ to a user
      description: >-
        Credits `quantity` units of one of your campaigns' action to the user
        the identifiers point at — found, or created once, never duplicated.
        **201** a new credit; **200** an identical replay of the same
        `external_reference` (the same credit is returned, nothing is credited
        twice). Refusals are `application/problem+json` with a stable
        `error_code`. Scope `partner.credit`.
      operationId: partner_credits_create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PartnerCreditRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/PartnerCreditRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/PartnerCreditRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartnerCredit'
          description: ''
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartnerCredit'
          description: ''
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: ''
        '402':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: ''
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: ''
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: ''
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: ''
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
          description: ''
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: ''
      security:
        - apiKeyAuth: []
components:
  schemas:
    PartnerCreditRequest:
      type: object
      description: >-
        Body of a credit. Your partner account is never in the body: it is the
        API key's.
      properties:
        campaign_id:
          type: integer
          minimum: 1
        quantity:
          type: string
          format: decimal
          pattern: ^-?\d{0,18}(?:\.\d{0,6})?$
          description: >-
            Units of the campaign's action (e.g. litres), > 0, at most 6
            decimals.
        external_reference:
          type: string
          description: >-
            The partner's own id for this credit. Same reference + same data =
            the same credit.
          maxLength: 200
        phone:
          type: string
          nullable: true
          maxLength: 32
        email:
          type: string
          format: email
          nullable: true
        cpf:
          type: string
          nullable: true
          maxLength: 20
        wallet_address:
          type: string
          nullable: true
          maxLength: 64
        name:
          type: string
          nullable: true
          maxLength: 255
      required:
        - campaign_id
        - external_reference
        - quantity
    PartnerCredit:
      type: object
      description: A credit your partner account made.
      properties:
        id:
          type: string
          format: uuid
        external_reference:
          type: string
        campaign_id:
          type: integer
        quantity:
          type: string
          format: decimal
          pattern: ^-?\d{0,18}(?:\.\d{0,6})?$
        unit:
          type: string
        unit_value:
          type: string
          format: decimal
          pattern: ^-?\d{0,16}(?:\.\d{0,2})?$
        amount:
          type: string
          format: decimal
          pattern: ^-?\d{0,16}(?:\.\d{0,2})?$
        customer_id:
          type: string
        status:
          type: string
          readOnly: true
          description: >-
            `settling`: the Z$ is already spendable and its on-chain record is
            pending; `settled`: recorded on-chain; `settlement_failed`: the
            on-chain record failed for good; `unknown`: contact Zupy support.
        created_at:
          type: string
          format: date-time
      required:
        - amount
        - campaign_id
        - created_at
        - customer_id
        - external_reference
        - id
        - quantity
        - status
        - unit
        - unit_value
    Error:
      type: object
      description: RFC 7807 Problem Details error response.
      properties:
        type:
          type: string
          format: uri
        title:
          type: string
        status:
          type: integer
        detail:
          type: string
        instance:
          type: string
      required:
        - detail
        - instance
        - status
        - title
        - type
    ValidationError:
      type: object
      description: RFC 7807 error with validation errors array.
      properties:
        type:
          type: string
          format: uri
        title:
          type: string
        status:
          type: integer
        detail:
          type: string
        instance:
          type: string
        errors:
          type: array
          items:
            $ref: '#/components/schemas/FieldError'
      required:
        - detail
        - errors
        - instance
        - status
        - title
        - type
    FieldError:
      type: object
      description: Individual field error in a validation error response.
      properties:
        field:
          type: string
        detail:
          type: string
      required:
        - detail
        - field
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        Per-company partner API key (zupy_pk_…). Validated by Zupy against the
        company integration key hash (Story 14.x); send it on every request as
        the X-API-Key header. Scoped read-write to the owning company's data.

````

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