Get field for event
Retrieves a single field configured on the specified event.
/v1/events/:pageId/fields/:fieldIdAuthorization
api_key_auth API key authentication. Use "Bearer YOUR_API_KEY" format.
In: header
Path Parameters
Unique identifier. Must be in BSON ObjectId format.
^[0-9a-fA-F]{24}$
Unique identifier. Must be in BSON ObjectId format.
^[0-9a-fA-F]{24}$
Returns
Field retrieved successfully
- idstring
Unique identifier for the field.
- labelstring
Display label shown to customers for this field.
- description?string, nullable
helper text shown below the field label.
- placeholder?string, nullable
Placeholder hint shown inside the input before a value is entered.
- elementstring
Input control used to render this field at checkout.
- type?string, nullable
Used to store field data in a predictable manner. Please note that you must use Customer Name and Shipping Address if you wish to use any of the shipping address data types.
Selectable options. Applies to
select,multi-selectandmultiple-choiceelements.- layout?string, nullable
How a multi-select field is drawn at checkout:
dropdown(the default) orlist, a list of checkboxes. Ignored on other elements.dropdownlist - requiredboolean
Whether this field must be completed before checkout can continue.
- ordernumber
Position of the field among the page's fields, from 0.
formLayouton the page decides the form's order. Each field'sorderis its position among the page's fields and follows the layout: saving a layout (in the dashboard or through the API) rewrites every field'sorder. On a page that has never saved a layout, settingordermoves the field; once a layout is saved, move fields withformLayoutinstead. - reference?string, nullable
Stable key that exports, Zapier, Google Sheets and webhooks use for this field's answers. Not updated when the label changes.
- disabled?boolean, nullable
Whether this field is switched off. A disabled field keeps its settings but is removed from the page entirely.
- hidden?boolean, nullable
Whether this field is hidden from customers at checkout.
Default value settings for the field.
Conditional visibility rules for this field.
Minimum allowed value rules for this field.
Maximum allowed value rules for this field.
Country restriction settings for fields that collect country data.
- showSelectedDialCode?boolean, nullable
Whether to display the selected international dial code in phone inputs.
- collect?string, nullable
Whether to collect only a billing address or both billing and shipping. Applies to
addresselements.billingbilling_and_shipping - collectShippingPhone?boolean, nullable
Whether to collect a phone number alongside the shipping address. Applies to
addresselements whencollectisbilling_and_shipping. Restrict the shipping country list. Applies to
addresselements whencollectisbilling_and_shipping.Restrict the billing country list. Applies to
addresselements.- defaultCountry?string, nullable
ISO 3166-1 alpha-2 country code used as the default for
addresselements. - createdAtstring
ISO-8601 timestamp for when the field was created.
- updatedAtstring
ISO-8601 timestamp for when the field was last updated.
- idstring
Bad request - Invalid request parameters
- statusstring
Indicates the request failed.
error - typestring
Machine-readable error category.
- messagestring
Human-readable error message.
Optional validation details for invalid requests.
Unauthorized - Missing or invalid API key
- statusstring
Indicates the request failed.
error - typestring
Machine-readable error category.
- messagestring
Human-readable error message.
Optional validation details for invalid requests.
Forbidden - Insufficient permissions or validation error
- statusstring
Indicates the request failed.
error - typestring
Machine-readable error category.
- messagestring
Human-readable error message.
Optional validation details for invalid requests.
event or field not found
- statusstring
Indicates the request failed.
error - typestring
Machine-readable error category.
- messagestring
Human-readable error message.
Optional validation details for invalid requests.
Rate Limit Exceeded - Please try again later.
- messagestring
Human-readable error message.
Internal server error
- statusstring
Indicates the request failed.
error - typestring
Machine-readable error category.
- messagestring
Human-readable error message.
Optional validation details for invalid requests.
import { createCheckoutPageClient } from '@checkoutpage/sdk';const checkoutpage = createCheckoutPageClient({ apiKey: process.env.CHECKOUTPAGE_API_KEY!,});const response = await checkoutpage.events.fields.get('65f4a1c2e4a9f3d2b1c0a9e8', '65f4a1c2e4a9f3d2b1c0a9e8');{
"data": {
"id": "507f1f77bcf86cd799439011",
"label": "Company Name",
"description": "We will use this on your invoice.",
"placeholder": "Enter your company name",
"element": "text",
"type": "company-name",
"options": [
{
"id": "65f4a1c2e4a9f3d2b1c0a9e8",
"label": "Label",
"value": "value"
}
],
"layout": "dropdown",
"required": true,
"order": 0,
"reference": "custom_field_1",
"disabled": false,
"hidden": false,
"defaultValue": {
"enabled": true,
"value": "string",
"values": [
"string"
]
},
"showHideLogic": {
"enabled": true,
"comparison": "is",
"value": "string",
"element": {
"elementTitle": "string",
"elementType": "field",
"elementId": "string"
}
},
"minValue": {
"enabled": true,
"value": "string"
},
"maxValue": {
"enabled": true,
"value": "string"
},
"limitAllowedCountries": {
"enabled": true,
"countries": [
"string"
]
},
"showSelectedDialCode": true,
"collect": "billing",
"collectShippingPhone": false,
"limitShippingCountries": {
"enabled": true,
"countries": [
"string"
]
},
"limitBillingCountries": {
"enabled": true,
"countries": [
"string"
]
},
"defaultCountry": "US",
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T10:30:00.000Z"
}
}{
"status": "error",
"type": "ValidationError",
"message": "Bad request - Invalid body: Field 'email' must be a valid email address",
"errors": [
{
"param": "email",
"message": "must be a valid email address"
}
]
}{
"status": "error",
"type": "error",
"message": "Missing or invalid API key"
}{
"status": "error",
"type": "error",
"message": "Insufficient permissions requires: BOOKINGS_WRITE"
}{
"status": "error",
"type": "error",
"message": "Field not found"
}{
"message": "API key rate limit exceeded. Please try again later."
}{
"status": "error",
"type": "error",
"message": "Internal server error"
}