---
title: "Buy a prepaid credit pack"
method: POST
path: "/v1/credits/purchases"
tags: ["Billing"]
---

# Buy a prepaid credit pack

`POST /v1/credits/purchases`

## Request

- Base URL: `https://serp-agent.com`
- URL: `https://serp-agent.com/v1/credits/purchases`
- Auth: HTTP bearer

Creates a one-time Creem checkout for a credit pack. Returns `checkout_url`: surface it to your human, who completes payment in the browser. Credits land on the account balance automatically via webhook on payment — poll GET /v1/credits. Sandbox keys get 403 `sandbox_not_billable`. Packs whose Creem product is not configured yet return 503 `billing_not_configured`.

## Headers

- `Idempotency-Key` string

## Request body

- object
  - `pack_id` 'pack_500' | 'pack_2000' | 'pack_10000', required

## Response `201`

Checkout created — hand `checkout_url` to a human to complete payment.

- CreditPackCheckout: A pending credit-pack purchase. Hand checkout_url to a human; credits land via webhook on payment.
  - `status` 'pending_payment', required
  - `checkout_url` string, uri, required
  - `pack_id` 'pack_500' | 'pack_2000' | 'pack_10000', required
  - `usd` number, required
  - `credits` integer, required
  - `bonus_credits` integer, required
  - `note` string

## Other responses

- `400`: Missing or unknown pack_id. Code: `invalid_request`.
- `401`: Missing, malformed, unknown, revoked, or expired API key. Codes: `unauthorized`, `key_revoked`, `key_expired`.
- `403`: Sandbox keys cannot make purchases. Code: `sandbox_not_billable`.
- `429`: Rate limit exceeded (600 requests/minute per API key). Honor `Retry-After`.
- `503`: This pack's Creem product is not configured yet. Code: `billing_not_configured`.

---

[API](https://skmtc.dev/serp-agent/apis/serp-agent-api.md) · [All operations](https://skmtc.dev/serp-agent/apis/serp-agent-api/llms.txt) · [OpenAPI document](https://skmtc.dev/serp-agent/apis/serp-agent-api/revisions/438a943019ac?raw)
