Get Project
Returns metadata for the project identified by the project-id header. This is the simplest way to confirm that authentication, abilities, and routing are configured correctly.
Request
GET /api/ HTTP/1.1
Host: app.nomacms.com
project-id: <project-uuid>
Authorization: Bearer <api-token>
Accept: application/jsonRequires the read ability on the token.
Query parameters
| Param | Description |
|---|---|
with | Optional. Comma-separated list of extra data to include. |
Supported with values:
| Value | Effect |
|---|---|
collections | Loads all collections for the project (name, slug, is_singleton, timestamps). |
fields | Loads fields on each collection (nested under collections, including group children flattened into the list). |
You can pass with=collections, with=fields, or with=collections,fields. Loading fields implies loading collections so that field definitions are attached to each collection.
For a full schema in one round trip, use GET /api/?with=collections,fields. That matches noma.project.get({ with: "collections,fields" }) in the JavaScript SDK.
Response (200)
JSON body always includes:
| Field | Type | Description |
|---|---|---|
uuid | string | Project UUID |
name | string | Project name |
description | string | null | Project description |
default_locale | string | Default locale code |
locales | string[] | Configured locale codes |
When collections are loaded, each item matches the collection shape returned by List Collections (and GET /api/collections/{slug} for a single collection): uuid, name, slug, is_singleton, created_at, updated_at, and optionally fields when that relationship was eager-loaded.
Errors
| Status | When |
|---|---|
| 401 | Missing or invalid bearer token |
| 403 | Token does not have read (or *) |
| 404 | No project with that UUID (Project not found.) |
| 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!,
})
const project = await client.project.get({ with: "collections,fields" })
console.log(project)import axios from "axios"
async function main() {
const { data } = await axios.get("https://app.nomacms.com/api/", {
params: { with: "collections,fields" },
headers: {
"project-id": process.env.NOMA_PROJECT_ID!,
Authorization: `Bearer ${process.env.NOMA_API_KEY}`,
Accept: "application/json",
},
})
console.log(data)
}
void main()<?php
$ch = curl_init('https://app.nomacms.com/api/?with=collections,fields');
curl_setopt_array($ch, [
CURLOPT_HTTPHEADER => [
'project-id: ' . getenv('NOMA_PROJECT_ID'),
'Authorization: Bearer ' . getenv('NOMA_API_KEY'),
'Accept: application/json',
],
CURLOPT_RETURNTRANSFER => true,
]);
echo curl_exec($ch);curl -sS \
-H "project-id: $NOMA_PROJECT_ID" \
-H "Authorization: Bearer $NOMA_API_KEY" \
-H "Accept: application/json" \
"https://app.nomacms.com/api/?with=collections,fields"package main
import (
"io"
"net/http"
"os"
)
func main() {
req, err := http.NewRequest("GET", "https://app.nomacms.com/api/?with=collections,fields", nil)
if err != nil {
panic(err)
}
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 "uri"
uri = URI("https://app.nomacms.com/api/?with=collections,fields")
req = Net::HTTP::Get.new(uri)
req["project-id"] = ENV.fetch("NOMA_PROJECT_ID")
req["Authorization"] = "Bearer #{ENV.fetch('NOMA_API_KEY')}"
req["Accept"] = "application/json"
Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
puts http.request(req).body
endimport os
import urllib.request
url = "https://app.nomacms.com/api/?with=collections,fields"
req = urllib.request.Request(
url,
headers={
"project-id": os.environ["NOMA_PROJECT_ID"],
"Authorization": f"Bearer {os.environ['NOMA_API_KEY']}",
"Accept": "application/json",
},
)
with urllib.request.urlopen(req) as res:
print(res.read().decode())Related
- Authentication - Headers and abilities
- JavaScript SDK -
createClientandproject.get