Reorder Collections
Sets the order value for one or more collections so they appear in the desired sequence (for example in the dashboard and in List Collections results).
Unknown UUIDs in the payload are skipped silently; matching collections are updated.
Request
POST /api/collections/reorder HTTP/1.1
Host: app.nomacms.com
Content-Type: application/json
project-id: <project-uuid>
Authorization: Bearer <api-token>
Accept: application/jsonRequires the admin ability on the token.
JSON body
| Field | Type | Required | Description |
|---|---|---|---|
collections | array | Yes | List of { uuid, order } entries |
Each item:
| Field | Type | Required | Description |
|---|---|---|---|
uuid | string | Yes | Collection uuid (not slug) |
order | number | Yes | Integer ≥ 0 (lower values sort first when listing) |
Response (200)
{ "message": "Collections reordered successfully." }Errors
| Status | When |
|---|---|
| 400 | Missing project-id or project cannot be resolved |
| 401 | Missing or invalid bearer token |
| 403 | Token does not have admin (or *) |
| 404 | No project with that UUID |
| 422 | Validation failed (missing collections, bad item shape, and so on) |
| 429 | Rate limited |
Example
import { createClient } from "@nomacms/js-sdk"
const client = createClient({
projectId: process.env.NOMA_PROJECT_ID!,
apiKey: process.env.NOMA_API_KEY!,
})
await client.collections.reorder({
collections: [
{ uuid: "aaaaaaaa-bbbb-4ccc-dddd-eeeeeeeeeeee", order: 0 },
{ uuid: "bbbbbbbb-bbbb-4ccc-dddd-ffffffffffff", order: 1 },
],
})import axios from "axios"
async function main() {
const { data } = await axios.post(
"https://app.nomacms.com/api/collections/reorder",
{
collections: [
{ uuid: "aaaaaaaa-bbbb-4ccc-dddd-eeeeeeeeeeee", order: 0 },
{ uuid: "bbbbbbbb-bbbb-4ccc-dddd-ffffffffffff", order: 1 },
],
},
{
headers: {
"Content-Type": "application/json",
"project-id": process.env.NOMA_PROJECT_ID!,
Authorization: `Bearer ${process.env.NOMA_API_KEY}`,
Accept: "application/json",
},
},
)
console.log(data)
}
void main()<?php
$payload = json_encode([
'collections' => [
['uuid' => 'aaaaaaaa-bbbb-4ccc-dddd-eeeeeeeeeeee', 'order' => 0],
['uuid' => 'bbbbbbbb-bbbb-4ccc-dddd-ffffffffffff', 'order' => 1],
],
]);
$ch = curl_init('https://app.nomacms.com/api/collections/reorder');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $payload,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'Content-Length: ' . strlen($payload),
'project-id: ' . getenv('NOMA_PROJECT_ID'),
'Authorization: Bearer ' . getenv('NOMA_API_KEY'),
'Accept: application/json',
],
CURLOPT_RETURNTRANSFER => true,
]);
echo curl_exec($ch);curl -sS -X POST "https://app.nomacms.com/api/collections/reorder" \
-H "Content-Type: application/json" \
-H "project-id: $NOMA_PROJECT_ID" \
-H "Authorization: Bearer $NOMA_API_KEY" \
-H "Accept: application/json" \
-d '{"collections":[{"uuid":"aaaaaaaa-bbbb-4ccc-dddd-eeeeeeeeeeee","order":0},{"uuid":"bbbbbbbb-bbbb-4ccc-dddd-ffffffffffff","order":1}]}'package main
import (
"bytes"
"encoding/json"
"io"
"net/http"
"os"
)
func main() {
body := map[string]any{
"collections": []any{
map[string]any{"uuid": "aaaaaaaa-bbbb-4ccc-dddd-eeeeeeeeeeee", "order": 0},
map[string]any{"uuid": "bbbbbbbb-bbbb-4ccc-dddd-ffffffffffff", "order": 1},
},
}
raw, _ := json.Marshal(body)
req, err := http.NewRequest("POST", "https://app.nomacms.com/api/collections/reorder", bytes.NewReader(raw))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("project-id", os.Getenv("NOMA_PROJECT_ID"))
req.Header.Set("Authorization", "Bearer "+os.Getenv("NOMA_API_KEY"))
req.Header.Set("Accept", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
_, _ = io.Copy(os.Stdout, res.Body)
}require "net/http"
require "json"
require "uri"
uri = URI("https://app.nomacms.com/api/collections/reorder")
payload = {
"collections" => [
{ "uuid" => "aaaaaaaa-bbbb-4ccc-dddd-eeeeeeeeeeee", "order" => 0 },
{ "uuid" => "bbbbbbbb-bbbb-4ccc-dddd-ffffffffffff", "order" => 1 }
]
}
req = Net::HTTP::Post.new(uri)
req["Content-Type"] = "application/json"
req["project-id"] = ENV.fetch("NOMA_PROJECT_ID")
req["Authorization"] = "Bearer #{ENV.fetch('NOMA_API_KEY')}"
req["Accept"] = "application/json"
req.body = JSON.generate(payload)
Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
puts http.request(req).body
endimport json
import os
import urllib.request
payload = {
"collections": [
{"uuid": "aaaaaaaa-bbbb-4ccc-dddd-eeeeeeeeeeee", "order": 0},
{"uuid": "bbbbbbbb-bbbb-4ccc-dddd-ffffffffffff", "order": 1},
]
}
data = json.dumps(payload).encode()
req = urllib.request.Request(
"https://app.nomacms.com/api/collections/reorder",
data=data,
headers={
"Content-Type": "application/json",
"project-id": os.environ["NOMA_PROJECT_ID"],
"Authorization": f"Bearer {os.environ['NOMA_API_KEY']}",
"Accept": "application/json",
},
method="POST",
)
with urllib.request.urlopen(req) as res:
print(res.read().decode())Related
- Authentication - Abilities (
admin) - List Collections - Collections are returned in
order - JavaScript SDK -
collections.reorder