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

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

const definition = await client.customFieldDefinitions.create({
  namespace: 'specs',
  key: 'origin',
  label: 'Country of Origin',
  field_type: 'short_text',
  resource_type: 'Spree::Product',
  storefront_visible: true,
})
{
  "id": "cfdef_EfhxLZ9ck8",
  "namespace": "specs",
  "key": "origin",
  "label": "Country of Origin",
  "field_type": "short_text",
  "resource_type": "Spree::Product",
  "storefront_visible": true,
  "created_at": "2026-05-24T17:36:37.407Z",
  "updated_at": "2026-05-24T17:36:37.407Z"
}

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
key
string
required
field_type
string
required

Custom field type identifier (one of the registered field-type class names).

resource_type
string
required

Owner class, e.g. Spree::Product

namespace
string

Defaults to custom

label
string

Human-readable name; defaults to titleized key

storefront_visible
boolean

When false, definition is admin-only (was display_on: back_end)

Response

201 - application/json

definition created