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

# Add or Remove Funds

> Credit or debit a customer's balance when they pay you outside Juiced.

Use this when a customer pays you through your own billing system, like an invoice or a bank transfer, and the money belongs in their Juiced balance. It works just like adding or removing funds on the customer in Juiced. Their bids see the new balance right away, and the customer's activity timeline shows your API key's label.

> [!NOTE]
>
> No card is charged. A credit adds to the customer's balance and a debit takes from it, and that's all that happens. Collect the payment yourself before you send the credit.

* **A `credit`** adds `amount` to the customer's balance. Add a `receipt_url` to link the customer to your own receipt. It's only accepted on credits.
* **A `debit`** takes `amount` from the customer's balance. It can't be more than the customer's `balance` from [Get a Customer](https://docs.usejuiced.com/api-reference/endpoint/v1/customers-get.md), which subtracts funds held for pending pings. A larger debit is refused with `validation_failed` on `amount`, the message names that balance, and nothing moves.

`amount` is in dollars, with at most 2 decimal places, from 0.01 up to 99,999,999.99. It's always positive, since `type` sets the direction. `description` is required and shows on the customer's transactions in their portal, so write it for them.

The response's `balance` is the customer's wallet balance right after this credit or debit, before funds held for pending pings. It's the same figure the transaction shows in [List Transactions](https://docs.usejuiced.com/api-reference/endpoint/v1/transactions-list.md), and a replayed response carries it too.

Archived customers can be credited and debited too. Credits and debits for one customer run one at a time, so each request sees the balance the one before it left. This endpoint needs the `funds:write` ability.

## The Idempotency-Key header is required

Because this endpoint moves money, every request must send an `Idempotency-Key` header. A request without one returns `422` with `validation_failed`, the error names the `Idempotency-Key` header, and no money moves.

Use an ID from your own system, such as your payment or invoice ID, so a retry of the same payment always sends the same key. A key belongs to the customer URL it was first sent to.

* **Same key, same body, same customer** within 24 hours returns the first response again, with an `Idempotent-Replayed: true` header. The funds only move once.
* **Same key, different body** returns `409` with `idempotency_conflict`.
* **Same key and body for a different customer** also returns `409` with `idempotency_conflict`, and nothing moves. It's never replayed as the first customer's response.
* **The first request is still running** returns `409` with `idempotency_in_progress` and a `Retry-After` header.
* **A server error** (`5xx`) moves no money and isn't saved against the key, so send the same request again.

See [Safe retries](https://docs.usejuiced.com/api-reference/api-keys.md#safe-retries) for the details.


## OpenAPI

````yaml POST /v1/customers/{id}/transactions
openapi: 3.1.0
info:
  title: Juiced API
  description: >-
    API for submitting pings and leads to Juiced. Build on the v1 endpoints
    under `/v1`. The unversioned `/ping` and `/leads` endpoints are the frozen
    legacy contract and are deprecated.
  version: 1.0.0
servers:
  - url: https://usejuiced.com/api
    description: Production server
security:
  - Basic Auth: []
  - Bearer Token: []
tags:
  - name: v1
    description: The current API. Build on these endpoints.
  - name: Customers
    description: Create and look up your customers with an API key.
  - name: Leads
    description: Look up your leads and their details with an API key.
  - name: Funds
    description: >-
      Add funds to and remove funds from a customer's balance, and list their
      transactions.
  - name: Bids
    description: Manage your customers' bids and look up your lead types.
  - name: Legacy
    description: The frozen, deprecated unversioned endpoints.
paths:
  /v1/customers/{id}/transactions:
    post:
      tags:
        - Funds
      summary: Add or remove funds
      description: >-
        Credits or debits the customer's balance. No card is charged.


        The `Idempotency-Key` header is required. Use an ID from your own
        system, such as your payment ID.


        Requires the `funds:write` ability.
      operationId: createCustomerTransactionV1
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            pattern: ^cus_[0-9a-z]{26}$
          description: The customer's ID.
        - name: Idempotency-Key
          in: header
          required: true
          schema:
            type: string
            maxLength: 255
          description: >-
            Required. An ID from your own system, such as your payment ID. A
            retry with the same key and body to the same customer within 24
            hours returns the first response, and the funds move once. The same
            key sent for a different customer, or with a different body, is a
            `409` conflict.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TransactionRequestV1'
            examples:
              Credit:
                summary: Credit
                value:
                  type: credit
                  amount: 125.5
                  description: Invoice 1042 paid
                  receipt_url: https://billing.example.com/r/1042
              Debit:
                summary: Debit
                value:
                  type: debit
                  amount: 20
                  description: Refunded to card
      responses:
        '201':
          description: >-
            Funds moved. A retry with the same `Idempotency-Key` and body to the
            same customer returns this same response again, with an
            `Idempotent-Replayed: true` header.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
            Idempotent-Replayed:
              description: >-
                Sent as `true` when this is a stored response to a retried
                request.
              schema:
                type: string
                example: 'true'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TransactionResponseV1'
              examples:
                Credit:
                  summary: Credit
                  value:
                    data:
                      id: txn_01jbxb3d5f7h9k1m3p5r7t9v2w
                      type: credit
                      event: manual_credit
                      amount: 125.5
                      balance: 125.5
                      description: Invoice 1042 paid
                      lead: null
                      receipt_url: https://billing.example.com/r/1042
                      created_at: '2026-11-19T16:20:00Z'
                    version: v1
                Debit:
                  summary: Debit
                  value:
                    data:
                      id: txn_01jbxc5f7h9k1m3p5r7t9v1x3z
                      type: debit
                      event: manual_debit
                      amount: -20
                      balance: 80.5
                      description: Refunded to card
                      lead: null
                      receipt_url: null
                      created_at: '2026-11-21T08:15:00Z'
                    version: v1
        '401':
          $ref: '#/components/responses/ApiKeyUnauthenticatedV1'
        '403':
          description: >-
            The key lacks the ability this endpoint needs, your plan doesn't
            include the API, or your account is locked for an unpaid
            subscription.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorV1'
              examples:
                Missing ability:
                  summary: Missing ability
                  value:
                    error:
                      code: bad_request
                      message: This API key does not have the funds:write ability.
                    version: v1
                Plan without the API:
                  summary: Plan without the API
                  value:
                    error:
                      code: bad_request
                      message: >-
                        The API is not included in your plan. Upgrade to a paid
                        plan to use it.
                    version: v1
                Account locked:
                  summary: Account locked
                  value:
                    error:
                      code: bad_request
                      message: This workspace is locked until its subscription is paid.
                    version: v1
        '404':
          description: No customer in your account has this ID.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorV1'
              example:
                error:
                  code: not_found
                  message: No customer matches this request.
                version: v1
        '409':
          description: >-
            The `Idempotency-Key` was already used and this request can't be
            replayed.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
            Retry-After:
              description: >-
                Sent with `idempotency_in_progress` only. Seconds to wait before
                retrying the same request.
              schema:
                type: integer
                example: 5
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorV1'
              examples:
                Same key, different body:
                  summary: Same key, different body
                  value:
                    error:
                      code: idempotency_conflict
                      message: >-
                        This Idempotency-Key was already used with a different
                        request body.
                    version: v1
                First request still running:
                  summary: First request still running
                  value:
                    error:
                      code: idempotency_in_progress
                      message: >-
                        A request with this Idempotency-Key is still being
                        processed. Retry after the number of seconds in the
                        Retry-After header.
                    version: v1
        '422':
          description: The request failed validation, and no money moved.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorV1'
              examples:
                No Idempotency-Key:
                  summary: No Idempotency-Key
                  value:
                    error:
                      code: validation_failed
                      message: >-
                        This request needs an Idempotency-Key header, so a retry
                        never runs it twice. Use an id from your own system,
                        such as your payment id.
                      errors:
                        Idempotency-Key:
                          - >-
                            This request needs an Idempotency-Key header, so a
                            retry never runs it twice. Use an id from your own
                            system, such as your payment id.
                    version: v1
                Debit over the balance:
                  summary: Debit over the balance
                  value:
                    error:
                      code: validation_failed
                      message: >-
                        The amount may not exceed the customer's balance of
                        $30.00.
                      errors:
                        amount:
                          - >-
                            The amount may not exceed the customer's balance of
                            $30.00.
                    version: v1
                Receipt on a debit:
                  summary: Receipt on a debit
                  value:
                    error:
                      code: validation_failed
                      message: A receipt URL can only be sent with a credit.
                      errors:
                        receipt_url:
                          - A receipt URL can only be sent with a credit.
                    version: v1
        '429':
          $ref: '#/components/responses/RateLimitedV1'
        '500':
          $ref: '#/components/responses/ServerErrorV1'
      security:
        - API Key: []
components:
  schemas:
    TransactionRequestV1:
      title: Transaction Request
      type: object
      required:
        - type
        - amount
        - description
      properties:
        type:
          type: string
          enum:
            - credit
            - debit
          description: '`credit` adds to the customer''s balance and `debit` takes from it.'
        amount:
          type: number
          minimum: 0.01
          maximum: 99999999.99
          description: >-
            In dollars, with at most 2 decimal places. Always positive, since
            `type` sets the direction. A debit can't be more than the customer's
            balance.
        description:
          type: string
          maxLength: 255
          description: >-
            What the funds are for, like `Invoice 1042 paid`. The customer sees
            it on their transactions.
        receipt_url:
          type:
            - string
            - 'null'
          format: uri
          maxLength: 2048
          description: >-
            Credits only. A link to the receipt in your own billing system.
            Sending one with a debit is refused.
    TransactionResponseV1:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/TransactionV1'
        version:
          type: string
          enum:
            - v1
    ErrorV1:
      title: Error
      type: object
      required:
        - error
        - version
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              enum:
                - unauthenticated
                - validation_failed
                - quota_reached
                - ping_mismatch
                - idempotency_conflict
                - idempotency_in_progress
                - idempotency_reserved
                - idempotency_version_mismatch
                - rate_limited
                - not_found
                - method_not_allowed
                - bad_request
                - server_error
              description: Machine-readable error code. Branch on this, not on `message`.
            message:
              type: string
              description: Human-readable explanation.
            errors:
              type: object
              description: Only with `validation_failed`. Messages keyed by field.
              additionalProperties:
                type: array
                items:
                  type: string
            lead_id:
              type: string
              pattern: ^lead_[0-9a-z]{26}$
              description: >-
                Only with `idempotency_version_mismatch`. The lead the
                `transaction_id` already created.
            bid:
              type: string
              pattern: ^bid_[0-9a-z]{26}$
              description: >-
                Only when a customer already has an active bid on that lead type
                and location. That bid's ID, so you can change it instead.
        version:
          type: string
          enum:
            - v1
          description: Always `v1`.
    TransactionV1:
      title: Transaction
      type: object
      properties:
        id:
          type: string
          pattern: ^txn_[0-9a-z]{26}$
          description: The transaction's public ID.
        type:
          type: string
          enum:
            - credit
            - debit
          description: '`credit` added to the balance and `debit` took from it.'
        event:
          type: string
          enum:
            - customer_payment
            - lead_charge
            - manual_credit
            - lead_refund
            - manual_debit
            - auto_recharge
            - buy_order_placed
            - buy_order_canceled
            - buy_order_released
            - checkout_bonus
          description: >-
            What produced the transaction. See [List
            Transactions](/api-reference/endpoint/v1/transactions-list) for what
            each one means.
        amount:
          type: number
          description: In dollars. Positive for a credit, negative for a debit.
        balance:
          type: number
          description: >-
            The customer's wallet balance right after this transaction, in
            dollars, before funds held for pending pings. It's the same in the
            transaction history and in the response to [Add or Remove
            Funds](/api-reference/endpoint/v1/transactions-create).
        description:
          type: string
          description: >-
            What the transaction was for. Your own description on credits and
            debits you make, otherwise a short label for the event, like `Lead
            charge` or `Payment`.
        lead:
          type:
            - string
            - 'null'
          description: >-
            The lead's ID when the transaction is for a lead, such as a
            `lead_charge` or `lead_refund`.
          pattern: ^lead_[0-9a-z]{26}$
        receipt_url:
          type:
            - string
            - 'null'
          description: >-
            A link to the payment's receipt. Only on `customer_payment`,
            `manual_credit` and `auto_recharge`.
        created_at:
          type: string
          format: date-time
  headers:
    XRequestId:
      description: >-
        Unique ID for this request, sent on every v1 response (errors included).
        Quote it when contacting support.
      schema:
        type: string
        pattern: ^req_[0-9a-z]{26}$
        example: req_01jbx8k6y3a5c7e9g1j3m5p7rt
    RetryAfter:
      description: Seconds to wait before retrying.
      schema:
        type: integer
        example: 30
  responses:
    ApiKeyUnauthenticatedV1:
      description: The API key is missing, unknown, revoked or expired.
      headers:
        X-Request-Id:
          $ref: '#/components/headers/XRequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorV1'
          example:
            error:
              code: unauthenticated
              message: >-
                Missing or invalid API key. Send an active jz_live_ key as a
                bearer token.
            version: v1
    RateLimitedV1:
      description: Too many requests.
      headers:
        X-Request-Id:
          $ref: '#/components/headers/XRequestId'
        Retry-After:
          $ref: '#/components/headers/RetryAfter'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorV1'
          example:
            error:
              code: rate_limited
              message: >-
                Too many requests. Retry after the number of seconds in the
                Retry-After header.
            version: v1
    ServerErrorV1:
      description: >-
        Something went wrong on our side. Quote the `X-Request-Id` header when
        contacting support.
      headers:
        X-Request-Id:
          $ref: '#/components/headers/XRequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorV1'
          example:
            error:
              code: server_error
              message: >-
                An unexpected error occurred. Quote the X-Request-Id header when
                contacting support.
            version: v1
  securitySchemes:
    Basic Auth:
      type: http
      scheme: basic
      description: >-
        Use your source's API key as the username and API secret as the
        password. Base64 encode the credentials in the format
        `api_key:api_secret`.
    Bearer Token:
      type: http
      scheme: bearer
      description: Use a bearer token generated for your source.
    API Key:
      type: http
      scheme: bearer
      description: >-
        An API key from **Configure → API Keys** (it starts with `jz_live_`),
        sent as a bearer token. See [API Keys](/api-reference/api-keys).

````

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