Skip to content

Object Types

The following endpoints allow you to get, add, edit and delete Object Types in your Bucket.

Quick Tip
Your read and write keys will be required to perform the following requests. These can be found in Your Bucket > Settings > API Access in your Bucket Dashboard .

Get Object Types

Get all Object Types in your Bucket.

ParameterRequiredTypeDescription
read_keyrequiredStringRestrict read access to your Bucket
prettyEnumtrue, Makes the response more reader-friendly

Methods

GET $BASE_URL/buckets/${bucket_slug}/object-types

Example Response

{
"object_types": [
{
"title": "Posts",
"slug": "posts",
"singular": "Post",
"metafields": [
{
"children": null,
"type": "object",
"title": "Category",
"key": "category",
"id": "qc8ado5qusyaj9og8yi8",
"object_type": "categories",
"value": "5f7357967286d7773adc551e"
},
{
"children": null,
"type": "text",
"title": "Headline",
"key": "headline",
"id": "g6Klj1ABP8",
"value": ""
}
],
"options": {
"slug_field": 1,
"content_editor": 1
},
"preview_link": "",
"priority_locale": null,
"extensions": null,
"order": 0,
"localization": false,
"locales": null,
"emoji": ""
},
{
"title": "Pages",
"slug": "pages",
"singular": "Page",
"metafields": [],
"options": {
"slug_field": 1,
"content_editor": 1
},
"preview_link": "",
"priority_locale": null,
"extensions": null,
"emoji": "📁",
"order": 1
}
]
}

Get Object Type

Get Object Type by type_slug from your Bucket.

ParameterRequiredTypeDescription
read_keyrequiredStringRestrict read access to your Bucket
prettyEnumtrue, Makes the response more reader-friendly

Definition

GET $BASE_URL/buckets/${bucket_slug}/object-types/${type_slug}

Example Response

{
"object_type": {
"title": "Pages",
"slug": "pages",
"singular": "Page",
"metafields": [],
"options": {
"slug_field": 1,
"content_editor": 1
},
"preview_link": "",
"priority_locale": null,
"extensions": null,
"emoji": "📁",
"order": 1
}
}

Add Object Type

Add a new Object Type to your Bucket.

Required
write_key must be passed as Authorization Bearer in the header of the request.

ParameterRequiredTypeDescription
titlerequiredStringPlural title of your Object Type
slugStringPlural slug of your Object Type
singularStringSingular title of your Object Type
metafieldsArray of ObjectsDefault Metafields for each Object in this type. Add Metafields to your Object. See Metafields Model.
options.slug_fieldBooleanSet to false to hide the slug field
options.content_editorBooleanSet to false to hide the content editor
localizationEnumtrue, Adds localization to the Object Type
localesrequired if localization is trueArray of StringArray of active locales in the Object Type. Check the available locale codes.
priority_localeStringDefault locale code for Objects in Object Type. Check the available locale codes
emojiStringValid Unicode emoji
prettyEnumtrue, Makes the response more reader-friendly

Methods

POST $BASE_URL/buckets/${bucket_slug}/object-types

Header

{
"Authorization": "Bearer n5MbD59UPBoVpyqi6B6DnOzAvZ..."
}

Example Body (JSON)

{
"title": "Categories"
}

Example Response

{
"object_type": {
"title": "Categories",
"slug": "categories",
"singular": "Categories",
"metafields": [],
"created_at": "2021-01-07T14:08:24.309Z",
"modifield_at": "2021-01-07T14:08:24.309Z",
"localization": false,
"locales": [],
"priority_locale": ""
}
}

Edit Object Type

Edit an existing Object Type by type_slug in your Bucket.

Required
write_key must be passed as Authorization Bearer in the header of the request.

ParameterRequiredTypeDescription
titleStringPlural title of your Object Type
singularStringSingular title of your Object Type
metafieldsArray of ObjectsDefault Metafields for each Object in this type. Add Metafields to your Object. See Metafields Model.
options.slug_fieldBooleanSet to false to hide the slug field
options.content_editorBooleanSet to false to hide the content editor
localizationEnumtrue, Adds localization to the Object Type
localesrequired if localization is trueArray of StringArray of active locales in the Object Type. Check the available locale codes.
priority_localeStringDefault locale code for Objects in Object Type. Check the available locale codes
emojiStringValid Unicode emoji
prettyEnumtrue, Makes the response more reader-friendly

Note: At least one of the Parameters is required to process the request.

Methods

PATCH $BASE_URL/buckets/${bucket_slug}/object-types/${type_slug}

Header

{
"Authorization": "Bearer n5MbD59UPBoVpyqi6B6DnOzAvZ..."
}

Example Body (JSON)

{
"singular": "Category"
}

Example Response

{
"object_type": {
"title": "Categories",
"slug": "categories",
"singular": "Category",
"metafields": [],
"created_at": "2021-01-07T14:08:24.309Z",
"modifield_at": "2021-01-07T14:17:04.124Z",
"localization": false,
"locales": [],
"priority_locale": ""
}
}

Delete Object Type

Delete an existing Object Type by type_slug from your Bucket.

Required
write_key must be passed as Authorization Bearer in the header of the request.

Note: This does not delete Objects in this Object Type.

Methods

DELETE $BASE_URL/buckets/${bucket_slug}/object-types/${type_slug}

Header

{
"Authorization": "Bearer n5MbD59UPBoVpyqi6B6DnOzAvZ..."
}

Example Response

{
"message": "Object Type with slug 'categories' deleted successfully from bucket."
}