Reorder Fields

Reorder Fields

This endpoint updates the display order of fields within a collection.

Endpoint

[POST]

/collections/{collection_slug}/fields/reorder

Permissions

This endpoint requires a token with the admin ability.

Path Parameters

NameRequiredDescription
collection_slugYesThe slug of the collection.

Headers

NameRequiredDescription
AcceptYesSpecifies the response content type. Must be application/json.
AuthorizationYesRequired. Must be a Bearer token with admin scope.
project-idYesThe unique identifier for the project.

Body Parameters

NameTypeRequiredDescription
fieldsarrayYesAn array of field order objects.
fields.*.uuidstringYesThe UUID of the field.
fields.*.orderintegerYesThe 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."
}

Search documentation

Find guides and reference pages