ResourcesAPI Examples
Resources
API Examples
Copy-ready requests, responses, and integration patterns.
This demo reference shows how teams can combine narrative guidance, parameter tables, and executable examples on one page.
Create a project
bash
curl --request POST \
--url https://api.example.com/v1/projects \
--header 'Authorization: Bearer YOUR_TOKEN' \
--header 'Content-Type: application/json' \
--data '{"name":"Knowledge Hub","region":"eu"}'Request body
| Field | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Human-readable project name |
| region | string | No | Hosting region; defaults to us |
| visibility | string | No | Either private or public |
Example response
json
{
"id": "prj_8f31a2",
"name": "Knowledge Hub",
"region": "eu",
"status": "ready",
"created_at": "2026-08-05T07:00:00Z"
}Status codes
| Code | Meaning | Recommended action |
|---|---|---|
| 201 | Project created | Store the returned project ID |
| 400 | Invalid request | Check fields and value formats |
| 401 | Authentication failed | Refresh or replace the token |
| 429 | Rate limit reached | Retry with exponential backoff |
Never place production API tokens in client-side code, screenshots, or documentation examples.
JavaScript example
javascript
const response = await fetch('https://api.example.com/v1/projects', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.API_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ name: 'Knowledge Hub', region: 'eu' }),
});
const project = await response.json();
console.log(project.id);