Skip to main content
POST
/
api
/
v3
/
admin
/
gift_card_batches
Spree Admin SDK
import { createAdminClient } from '@spree/admin-sdk'

const client = createAdminClient({
  baseUrl: 'https://your-store.com',
  secretKey: 'sk_xxx',
})

const batch = await client.giftCardBatches.create({
  prefix: 'WELCOME',
  amount: '25.00',
  currency: 'USD',
  codes_count: 100,
  expires_at: '2030-12-31',
})
{
  "id": "gcb_gbHJdmfrXB",
  "codes_count": 5,
  "currency": "USD",
  "prefix": "NEWCAMP",
  "created_at": "2026-05-24T17:36:58.306Z",
  "updated_at": "2026-05-24T17:36:58.306Z",
  "amount": "25.0",
  "expires_at": "2030-12-31",
  "created_by_id": "admin_UkLWZg9DAJ"
}

Documentation Index

Fetch the complete documentation index at: https://spreecommerce.org/docs/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

x-spree-api-key
string
header
required

Secret API key for admin access

Authorization
string
header
required

JWT token for admin user authentication

Headers

x-spree-api-key
string
required
Authorization
string
required

Body

application/json
prefix
string
required

Lowercased and prepended to every generated code.

Example:

"WELCOME"

amount
string
required

Decimal amount per card, greater than zero.

Example:

"25.00"

codes_count
integer
required

Number of cards to generate. Capped at gift_card_batch_limit.

Example:

100

currency
string

ISO 4217 currency code. Defaults to the store currency.

Example:

"USD"

expires_at
string | null
Example:

"2030-12-31"

Response

gift card batch created

id
string
required
codes_count
number
required
currency
string | null
required
prefix
string | null
required
created_at
string
required
updated_at
string
required
amount
string | null
required
expires_at
string | null
required
created_by_id
string | null
required