Reorder Fields
This endpoint updates the display order of fields within a collection.
Endpoint
[POST]
/collections/{collection_slug}/fields/reorderPermissions
This endpoint requires a token with the admin ability.
Path Parameters
| Name | Required | Description |
|---|---|---|
collection_slug | Yes | The slug of the collection. |
Headers
| Name | Required | Description |
|---|---|---|
Accept | Yes | Specifies the response content type. Must be application/json. |
Authorization | Yes | Required. Must be a Bearer token with admin scope. |
project-id | Yes | The unique identifier for the project. |
Body Parameters
| Name | Type | Required | Description |
|---|---|---|---|
fields | array | Yes | An array of field order objects. |
fields.*.uuid | string | Yes | The UUID of the field. |
fields.*.order | integer | Yes | The new display order (0-based). |
Example Requests
const collectionSlug = 'blog-posts';
axios.post(`https://your-domain.com/api/collections/${collectionSlug}/fields/reorder`, {
fields: [
{ uuid: 'a1b2c3d4-0001-0000-0000-000000000001', order: 0 },
{ uuid: 'a1b2c3d4-0001-0000-0000-000000000002', order: 1 },
{ uuid: 'a1b2c3d4-0001-0000-0000-000000000003', order: 2 }
]
}, {
headers: {
'Accept': 'application/json',
'Authorization': 'Bearer YOUR_API_TOKEN',
'project-id': 'YOUR_PROJECT_UUID'
}
});use Illuminate\Support\Facades\Http;
$collectionSlug = 'blog-posts';
$response = Http::withToken('YOUR_API_TOKEN')->withHeaders([
'Accept' => 'application/json',
'project-id' => 'YOUR_PROJECT_UUID'
])->post("https://your-domain.com/api/collections/{$collectionSlug}/fields/reorder", [
'fields' => [
['uuid' => 'a1b2c3d4-...', 'order' => 0],
['uuid' => 'a1b2c3d4-...', 'order' => 1],
['uuid' => 'a1b2c3d4-...', 'order' => 2],
]
]);curl -X POST "https://your-domain.com/api/collections/blog-posts/fields/reorder" \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "project-id: YOUR_PROJECT_UUID" \
-H "Content-Type: application/json" \
-d '{
"fields": [
{ "uuid": "a1b2c3d4-...", "order": 0 },
{ "uuid": "a1b2c3d4-...", "order": 1 },
{ "uuid": "a1b2c3d4-...", "order": 2 }
]
}'Responses
200: Success
{
"message": "Fields reordered successfully."
}403: Forbidden
Returned if the API token does not have the admin ability.
{
"message": "API token doesn't have the right abilities!"
}404: Not Found
Returned if the collection with the specified slug does not exist.
{
"message": "Collection not found."
}