cURL
curl -X POST https://api.neuraldraft.io/v1/categories \
-H "Authorization: Bearer ndsk_live_yourkey" \
-H "Content-Type: application/json" \
-d '{"name":"Wellness"}'const cat = await nd.categories.create({ name: "Wellness" });
cat = requests.post("https://api.neuraldraft.io/v1/categories",
headers={"Authorization": f"Bearer {key}"}, json={"name":"Wellness"}).json()
<?php
$cat = json_decode((string) $client->post('categories', [
'headers' => ['Authorization' => 'Bearer '.$key],
'json' => ['name' => 'Wellness'],
])->getBody(), true);
{
"id": 7,
"name": "Wellness",
"slug": "wellness"
}{
"type": "https://api.neuraldraft.io/errors/bad_request",
"title": "Bad request",
"status": 400,
"detail": "Request body could not be parsed.",
"code": "bad_request",
"instance": "req_2Nh4PqRsTuVw"
}{
"type": "https://api.neuraldraft.io/errors/unauthorized",
"title": "Unauthorized",
"status": 401,
"detail": "API key missing or invalid.",
"code": "unauthorized",
"instance": "req_2Nh4PqRsTuVw"
}{
"type": "https://api.neuraldraft.io/errors/conflict",
"title": "Conflict",
"status": 409,
"detail": "A resource with this slug already exists.",
"code": "conflict",
"instance": "req_2Nh4PqRsTuVw"
}Blog
Create a category
POST
/
categories
cURL
curl -X POST https://api.neuraldraft.io/v1/categories \
-H "Authorization: Bearer ndsk_live_yourkey" \
-H "Content-Type: application/json" \
-d '{"name":"Wellness"}'const cat = await nd.categories.create({ name: "Wellness" });
cat = requests.post("https://api.neuraldraft.io/v1/categories",
headers={"Authorization": f"Bearer {key}"}, json={"name":"Wellness"}).json()
<?php
$cat = json_decode((string) $client->post('categories', [
'headers' => ['Authorization' => 'Bearer '.$key],
'json' => ['name' => 'Wellness'],
])->getBody(), true);
{
"id": 7,
"name": "Wellness",
"slug": "wellness"
}{
"type": "https://api.neuraldraft.io/errors/bad_request",
"title": "Bad request",
"status": 400,
"detail": "Request body could not be parsed.",
"code": "bad_request",
"instance": "req_2Nh4PqRsTuVw"
}{
"type": "https://api.neuraldraft.io/errors/unauthorized",
"title": "Unauthorized",
"status": 401,
"detail": "API key missing or invalid.",
"code": "unauthorized",
"instance": "req_2Nh4PqRsTuVw"
}{
"type": "https://api.neuraldraft.io/errors/conflict",
"title": "Conflict",
"status": 409,
"detail": "A resource with this slug already exists.",
"code": "conflict",
"instance": "req_2Nh4PqRsTuVw"
}Authorizations
Project API key. Pass as Authorization: Bearer ndsk_live_.... Manage
keys via /projects/me/api-keys. Test-mode keys use
the ndsk_test_ prefix.