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

# Sandbox faucet — mint test credit (sandbox only, 201)

> Sandbox-only instant test money. Credits the caller's ledger through the
same `fiat_issue` path as corroborated DOKU deposits (identical
balance/webhook behavior) without touching DOKU — works even when DOKU
sandbox is down. Every mint is audited. Per-identity caps: Rp50.000 per
call, Rp100.000/day, 10 calls/day (proposed — CTO confirms). The route
is registered only when the server flag `PID_FAUCET_ENABLED` is exactly
`"true"` (fail-closed; unset/false ⇒ absent). On production the route
does not exist: 404 (not 401/403 — no oracle).




## OpenAPI

````yaml /openapi.yaml post /fiat/test-credit
openapi: 3.0.3
info:
  title: PeridotID API
  version: 0.1.0
  description: >
    Gaming Identity Platform — Authentication, Identity, and Profile for the
    Peridot ecosystem.


    ## Base URL

    All endpoints are prefixed with `/v1`.


    | Environment | Base URL |

    |---|---|

    | Production | `https://api.pid.peridotvault.com/v1` |

    | Local dev | `http://localhost:3300/v1` |


    ## Authentication

    Authentication is **cookie-based**. After a successful Google sign-in the
    API sets two

    `HttpOnly` cookies:


    - `pid_access` — short-lived JWT access token (15 min), sent on every
    request.

    - `pid_refresh` — long-lived rotating refresh token (30 days), only sent to
    `/v1/auth`.


    Browsers handle these automatically; non-browser clients must send

    `Cookie: pid_access=<token>` on each request and call `/v1/auth/refresh`
    before the

    access token expires.
  contact:
    name: PeridotID
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: https://api.pid.peridotvault.com/v1
    description: Production
  - url: http://localhost:3300/v1
    description: Local development
security: []
tags:
  - name: auth
    description: Login, logout, token refresh, and machine (client-credentials) tokens
  - name: identity
    description: The user's identity across products
  - name: profile
    description: The user's public profile
  - name: wallet
    description: >
      The user's wallet, associated with their PID. **Deprecated (V3 surface)**
      — preserved

      for existing clients, backed by `linked_address` chain accounts. Use
      `/account` and

      the smart account instead.
  - name: account
    description: >-
      PeridotID account — owns chain accounts (smart account PDA, legacy linked
      address)
  - name: meta
    description: |
      Deployment metadata: self-describing environment endpoints (sandbox vs
      production). Public, server-derived, never echoing client input.
  - name: fiat
    description: |
      The internal IDR fiat ledger: balances, statements, sends, and money-in.
      Top-ups enter through a hosted DOKU Checkout page (no Sub-Account) and
      credit the internal ledger once the payment is corroborated. Any identity
      can send to any identity (escrow/payouts). Fees: global 0.1% (min Rp100,
      no cap) plus optional per-app fees that stack and credit the app. Bank
      withdrawals (redemption) are disabled for now.
  - name: apps
    description: |
      Third-party apps ("Sign in with PeridotID"): client_id, allowed origins,
      optional backend secret, ledger callbacks (deferred), and a per-app fee
      schedule. Owner-scoped — a non-owner gets 404. App backends authenticate
      server-side with `POST /v1/auth/token` (client credentials).
  - name: credentials
    description: >
      Signing authorities (secp256r1 passkeys). Google OAuth proves identity; a

      passkey authorizes the wallet. The first credential registers freely; each
      additional

      credential requires approval by an existing credential
      (existing-credential approval rule).
  - name: permissions
    description: >
      EVM permission grants (scoped P-256 session keys, WHITEPAPER.md §10).
      Validation is pure

      hygiene + canonical id/challenge computation; submission-time account
      binding

      is enforced by the relay path.
  - name: session-keys
    description: >
      SVM gameplay sessions (Ed25519 session keys in isolated PDAs,
      WHITEPAPER.md §11).

      Validation is pure hygiene + canonical address/challenge computation;

      submission-time vault binding is enforced by the relay path.
  - name: openapi
    description: Machine-readable API specification
paths:
  /fiat/test-credit:
    post:
      tags:
        - fiat
      summary: Sandbox faucet — mint test credit (sandbox only, 201)
      description: |
        Sandbox-only instant test money. Credits the caller's ledger through the
        same `fiat_issue` path as corroborated DOKU deposits (identical
        balance/webhook behavior) without touching DOKU — works even when DOKU
        sandbox is down. Every mint is audited. Per-identity caps: Rp50.000 per
        call, Rp100.000/day, 10 calls/day (proposed — CTO confirms). The route
        is registered only when the server flag `PID_FAUCET_ENABLED` is exactly
        `"true"` (fail-closed; unset/false ⇒ absent). On production the route
        does not exist: 404 (not 401/403 — no oracle).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - amountMinor
              properties:
                amountMinor:
                  type: integer
                  minimum: 1
                  maximum: 50000
                  example: 50000
      responses:
        '201':
          description: Test credit minted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FaucetCredit'
              example:
                ok: true
                creditId: 3fa85f64-5717-4562-b3fc-2c963f66afa6
                amountMinor: '50000'
                currency: IDR
                env: sandbox
                dailyRemainingMinor: '50000'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          description: Production (route absent) or unknown identity scope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '422':
          $ref: '#/components/responses/Unprocessable'
      security:
        - cookieAuth: []
components:
  schemas:
    FaucetCredit:
      type: object
      required:
        - ok
        - creditId
        - amountMinor
        - currency
        - env
        - dailyRemainingMinor
      properties:
        ok:
          type: boolean
        creditId:
          type: string
          format: uuid
          description: Ledger entryGroup of the minted faucet credit
        amountMinor:
          type: string
          description: >-
            Minted amount, whole IDR (decimal string, same convention as
            FiatBalance.balanceIdr)
        currency:
          type: string
          enum:
            - IDR
        env:
          type: string
          enum:
            - sandbox
        dailyRemainingMinor:
          type: string
          description: >-
            Faucet quota left for this identity today, whole IDR (decimal
            string)
    ApiError:
      type: object
      required:
        - statusCode
        - message
      properties:
        statusCode:
          type: integer
        message:
          oneOf:
            - type: string
            - type: array
              items:
                type: string
  responses:
    Unauthorized:
      description: Missing, expired, or invalid access/refresh token
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          example:
            statusCode: 401
            message: Unauthorized
    Unprocessable:
      description: Semantically invalid request (faucet amount/cap violations)
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          examples:
            invalidAmount:
              value:
                statusCode: 422
                error: faucet_invalid_amount
                perCallMaxMinor: '50000'
            capExceeded:
              value:
                statusCode: 422
                error: faucet_cap_exceeded
                dailyRemainingMinor: '0'
  securitySchemes:
    cookieAuth:
      type: apiKey
      in: cookie
      name: pid_access
      description: JWT access token set by /auth/google/callback or /auth/refresh

````

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