Custom Fields

Define custom data fields for products

GET /admin/api/custom-fields

List all custom fields with their choices. Returns the full detail including choices for select-type fields.

Response 200

[
  {
    "id": 1,
    "name": "Engraving Text",
    "slug": "engraving-text",
    "field_type": "text",
    "required": false,
    "placeholder": "Enter your text here",
    "sort_order": 0,
    "choices": []
  },
  {
    "id": 2,
    "name": "Gift Wrap",
    "slug": "gift-wrap",
    "field_type": "select",
    "required": false,
    "placeholder": null,
    "sort_order": 1,
    "choices": [
      {
        "id": 10,
        "value": "Standard",
        "slug": "standard",
        "sort_order": 0
      },
      {
        "id": 11,
        "value": "Premium",
        "slug": "premium",
        "sort_order": 1
      }
    ]
  },
  {
    "id": 3,
    "name": "Delivery Date",
    "slug": "delivery-date",
    "field_type": "date",
    "required": true,
    "placeholder": null,
    "sort_order": 2,
    "choices": []
  }
]

Example

curl "https://yourshop.zeroshop.io/admin/api/custom-fields" \
  -H "Authorization: Bearer zspat_..."
POST /admin/api/custom-fields

Create a new custom field. A URL slug is auto-derived from the name. Valid field_type values: text, textarea, date, number, select. Initial choices can be provided for select-type fields.

Request Body

{
  "name": "Gift Wrap",
  "field_type": "select",
  "required": false,
  "placeholder": null,
  "choices": [
    "Standard",
    "Premium",
    "Luxury"
  ]
}

Response 201

{
  "id": 2,
  "name": "Gift Wrap",
  "slug": "gift-wrap"
}

Example

curl -X POST "https://yourshop.zeroshop.io/admin/api/custom-fields" \
  -H "Authorization: Bearer zspat_..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Gift Wrap",
    "field_type": "select",
    "required": false,
    "choices": ["Standard", "Premium", "Luxury"]
  }'
GET /admin/api/custom-fields/{id}

Fetch a single custom field with its choices.

Response 200

{
  "id": 2,
  "name": "Gift Wrap",
  "slug": "gift-wrap",
  "field_type": "select",
  "required": false,
  "placeholder": null,
  "sort_order": 1,
  "choices": [
    {
      "id": 10,
      "value": "Standard",
      "slug": "standard",
      "sort_order": 0
    },
    {
      "id": 11,
      "value": "Premium",
      "slug": "premium",
      "sort_order": 1
    },
    {
      "id": 12,
      "value": "Luxury",
      "slug": "luxury",
      "sort_order": 2
    }
  ]
}

Example

curl "https://yourshop.zeroshop.io/admin/api/custom-fields/2" \
  -H "Authorization: Bearer zspat_..."
PUT /admin/api/custom-fields/{id}

Update a custom field's name, type, required flag, and placeholder. Re-derives the slug from the new name.

Request Body

{
  "name": "Gift Wrapping",
  "field_type": "select",
  "required": true,
  "placeholder": "Choose a wrapping style"
}

Response 204

Example

curl -X PUT "https://yourshop.zeroshop.io/admin/api/custom-fields/2" \
  -H "Authorization: Bearer zspat_..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Gift Wrapping",
    "field_type": "select",
    "required": true,
    "placeholder": "Choose a wrapping style"
  }'
DELETE /admin/api/custom-fields/{id}

Delete a custom field and all its choices.

Response 204

Example

curl -X DELETE "https://yourshop.zeroshop.io/admin/api/custom-fields/2" \
  -H "Authorization: Bearer zspat_..."
POST /admin/api/custom-fields/{id}/choices

Add a choice to a select-type custom field. A URL slug is auto-derived from the value.

Request Body

{
  "value": "Eco Friendly"
}

Response 201

{
  "id": 13,
  "value": "Eco Friendly",
  "slug": "eco-friendly"
}

Example

curl -X POST "https://yourshop.zeroshop.io/admin/api/custom-fields/2/choices" \
  -H "Authorization: Bearer zspat_..." \
  -H "Content-Type: application/json" \
  -d '{ "value": "Eco Friendly" }'
DELETE /admin/api/custom-fields/{id}/choices/{cid}

Delete a custom field choice.

Response 204

Example

curl -X DELETE "https://yourshop.zeroshop.io/admin/api/custom-fields/2/choices/13" \
  -H "Authorization: Bearer zspat_..."

We value your privacy

We use cookies for essential site functionality and, with your consent, analytics to understand how our platform is used. No personal data is shared with third parties. See our Privacy Policy for details.