POST /lookup/{table}/{field}
Create a new lookup value
Creates a new lookup value for a specific table and field. Only account administrators can create lookup values.
Authentication Required
Authorization: Bearer {token}
header string This header is required to access this endpoint
Required Parameters
x-account-id
header string Account ID for the request
table
path string The table name to create a lookup value for
field
path string The field name to create a lookup value for
Request Body
{ "text": "string", "value": "string"}{ "text": "Example Text", "value": "example_value"}{ "text": "Full Example Text", "value": "full_example_value", "data_type": "string", "parent_id": 1, "custom_sort_index": 10, "group_name": "Example Group", "locale": "en-US", "description": "This is a full example of a lookup value", "is_active": true, "metadata": { "additional_info": "Some extra information" }, "expires_at": "2023-12-31T23:59:59Z"}{ "text": "string", "value": "string", "table_name": "string", "field_name": "string", "data_type": "string", "parent_id": 0, "custom_sort_index": 0, "displayOrder": 0, "group_name": "string", "locale": "string", "description": "string", "is_active": false, "metadata": {}, "expires_at": "string"}Try it out
Loading...
Output:
Responses
Description
Lookup value created successfully
{ "message": "Lookup value created successfully", "lookupValue": { "id": 0, "text": "string", "value": "string", "displayOrder": 0, "metadata": {}, "parent_id": 0, "custom_sort_index": 0, "group_name": "string", "locale": "string", "description": "string", "is_active": false, "expires_at": "string" }}Description
Bad request - invalid input data
{ "error": "string", "status": 0, "message": "string"}Description
Unauthorized - User not authenticated
Description
Forbidden - User does not have permission to create lookup values
Description
Internal server error
{ "error": "string", "status": 0, "message": "string"}References
#/components/parameters/xAccountIdHeader#/components/schemas/CreateLookupValue#/components/schemas/LookupOption#/components/schemas/Error
#/components/parameters/xAccountIdHeader
in: headername: x-account-idschema: type: stringdescription: Account ID for the requestrequired: trueexample: "2311"|export type xAccountIdHeader = any; // Schema type not fully supported#/components/schemas/CreateLookupValue
type: objectdescription: Input for creating a new lookup valuerequired: - text - valueproperties: text: type: string description: Display text for the lookup option value: type: string description: Internal value for the lookup option table_name: type: string description: Optional override of the table name from the URL field_name: type: string description: Optional override of the field name from the URL data_type: type: string enum: - string - number - boolean - date - json description: Data type of the lookup value parent_id: type: integer description: ID of the parent lookup option if this is a child option custom_sort_index: type: integer description: Custom index for sorting the lookup options displayOrder: type: integer description: Order in which the option should be displayed group_name: type: string description: Group name for organizing lookup options locale: type: string description: Locale code for internationalization description: type: string description: Detailed description of the lookup option is_active: type: boolean description: Whether the lookup option is active metadata: type: object description: Additional data to store with the lookup option expires_at: type: string format: date-time description: Expiration date and time for the lookup option|export interface CreateLookupValue { /** Display text for the lookup option */ text: string; /** Internal value for the lookup option */ value: string; /** Optional override of the table name from the URL */ table_name?: string; /** Optional override of the field name from the URL */ field_name?: string; /** Data type of the lookup value */ data_type?: "string" | "number" | "boolean" | "date" | "json"; /** ID of the parent lookup option if this is a child option */ parent_id?: number; /** Custom index for sorting the lookup options */ custom_sort_index?: number; /** Order in which the option should be displayed */ displayOrder?: number; /** Group name for organizing lookup options */ group_name?: string; /** Locale code for internationalization */ locale?: string; /** Detailed description of the lookup option */ description?: string; /** Whether the lookup option is active */ is_active?: boolean; /** Additional data to store with the lookup option */ metadata?: {}; /** Expiration date and time for the lookup option */ expires_at?: Date;}#/components/schemas/LookupOption
type: objectdescription: Lookup option for a specific table/field combinationproperties: id: type: integer description: Unique identifier for the lookup option text: type: string description: Display text for the lookup option value: type: string description: Internal value of the lookup option displayOrder: type: integer description: Order in which the option should be displayed metadata: type: object description: Additional data associated with the lookup option parent_id: type: integer description: ID of the parent lookup option if this is a child option custom_sort_index: type: integer description: Custom index for sorting the lookup options group_name: type: string description: Group name for organizing lookup options locale: type: string description: Locale code for internationalization description: type: string description: Detailed description of the lookup option is_active: type: boolean description: Whether the lookup option is active expires_at: type: string format: date-time description: Expiration date and time for the lookup optionrequired: - id - value|export interface LookupOption { /** Unique identifier for the lookup option */ id: number; /** Display text for the lookup option */ text?: string; /** Internal value of the lookup option */ value: string; /** Order in which the option should be displayed */ displayOrder?: number; /** Additional data associated with the lookup option */ metadata?: {}; /** ID of the parent lookup option if this is a child option */ parent_id?: number; /** Custom index for sorting the lookup options */ custom_sort_index?: number; /** Group name for organizing lookup options */ group_name?: string; /** Locale code for internationalization */ locale?: string; /** Detailed description of the lookup option */ description?: string; /** Whether the lookup option is active */ is_active?: boolean; /** Expiration date and time for the lookup option */ expires_at?: Date;}#/components/schemas/Error
type: objectproperties: error: type: string description: Error message status: type: integer description: HTTP status code message: type: string description: Detailed error messagedescription: Error response objectrequired: - error|export interface Error { /** Error message */ error: string; /** HTTP status code */ status?: number; /** Detailed error message */ message?: string;}Route Source Code
Check out the source code for this route entrypoint here: /lookup/[table]/[field]/route.ts
Or the swagger.yaml spec this documentation was generated from:
/lookup/swagger.yaml