curl -X POST https://api.neuraldraft.io/v1/images \
-H "Authorization: Bearer ndsk_live_yourkey" \
-H "Content-Type: application/json" \
-d '{"prompt":"Serene yoga studio at dawn","style":"photorealistic","aspect_ratio":"16:9","key":"hero.background"}'{
"data": {
"key": "hero.background",
"url": "https://cdn.neuraldraft.io/prj_2NfQmBcKpXY8/hero-background-89hf.jpg",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"width": 2048,
"height": 1152,
"bytes": 482911,
"mime_type": "image/jpeg",
"generated": true
}
}{
"id": "job_2Ngd9KqLmRpW",
"type": "blog_post.generate",
"status": "pending",
"created_at": "2023-11-07T05:31:56Z",
"progress": 50,
"message": "<string>",
"steps": [
{
"name": "<string>",
"completed": true,
"active": true
}
],
"result": {},
"error": {
"code": "upstream_unavailable",
"message": "<string>"
},
"updated_at": "2023-11-07T05:31:56Z"
}{
"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://neuraldraft.com/errors/payment-required",
"title": "Payment Required",
"status": 402,
"detail": "This project has no credits remaining for the current period.",
"code": "insufficient_credits",
"cost": 1,
"balance": 0,
"instance": "req_2Nh4PqRsTuVw"
}{
"type": "https://api.neuraldraft.io/errors/forbidden",
"title": "Forbidden",
"status": 403,
"detail": "This API key does not have the `commerce:write` scope.",
"code": "forbidden",
"instance": "req_2Nh4PqRsTuVw"
}{
"type": "https://api.neuraldraft.io/errors/validation_failed",
"title": "Validation failed",
"status": 422,
"code": "validation_failed",
"detail": "One or more fields failed validation.",
"instance": "req_2Nh4PqRsTuVw",
"cost": 1,
"balance": 0,
"errors": {
"customer_email": [
"The customer email field must be a valid email."
],
"starts_at": [
"The starts at field must be a valid ISO 8601 date."
]
}
}{
"type": "https://api.neuraldraft.io/errors/service_unavailable",
"title": "Service unavailable",
"status": 503,
"detail": "A required upstream service is temporarily unavailable. Retry in 5 seconds.",
"code": "service_unavailable",
"instance": "req_2Nh4PqRsTuVw"
}Images
Generate or upload an image
Two modes — discriminated by the request Content-Type:
- AI generation (
application/json) — kicks off async generation inheriting the project’s brand context. Returns aJobwithtype: image.generate. On completion,resultcontains{ url, key, width, height }. Costs 32 credits (image). - Direct upload (
multipart/form-data) — synchronous swap with the uploaded file bytes.fileandkeyare required. Returns the registeredImageimmediately. Costs 1 credit (image_register). Max 10MB; jpg/jpeg/png/webp/gif/svg only.
POST
/
images
curl -X POST https://api.neuraldraft.io/v1/images \
-H "Authorization: Bearer ndsk_live_yourkey" \
-H "Content-Type: application/json" \
-d '{"prompt":"Serene yoga studio at dawn","style":"photorealistic","aspect_ratio":"16:9","key":"hero.background"}'{
"data": {
"key": "hero.background",
"url": "https://cdn.neuraldraft.io/prj_2NfQmBcKpXY8/hero-background-89hf.jpg",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"width": 2048,
"height": 1152,
"bytes": 482911,
"mime_type": "image/jpeg",
"generated": true
}
}{
"id": "job_2Ngd9KqLmRpW",
"type": "blog_post.generate",
"status": "pending",
"created_at": "2023-11-07T05:31:56Z",
"progress": 50,
"message": "<string>",
"steps": [
{
"name": "<string>",
"completed": true,
"active": true
}
],
"result": {},
"error": {
"code": "upstream_unavailable",
"message": "<string>"
},
"updated_at": "2023-11-07T05:31:56Z"
}{
"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://neuraldraft.com/errors/payment-required",
"title": "Payment Required",
"status": 402,
"detail": "This project has no credits remaining for the current period.",
"code": "insufficient_credits",
"cost": 1,
"balance": 0,
"instance": "req_2Nh4PqRsTuVw"
}{
"type": "https://api.neuraldraft.io/errors/forbidden",
"title": "Forbidden",
"status": 403,
"detail": "This API key does not have the `commerce:write` scope.",
"code": "forbidden",
"instance": "req_2Nh4PqRsTuVw"
}{
"type": "https://api.neuraldraft.io/errors/validation_failed",
"title": "Validation failed",
"status": 422,
"code": "validation_failed",
"detail": "One or more fields failed validation.",
"instance": "req_2Nh4PqRsTuVw",
"cost": 1,
"balance": 0,
"errors": {
"customer_email": [
"The customer email field must be a valid email."
],
"starts_at": [
"The starts at field must be a valid ISO 8601 date."
]
}
}{
"type": "https://api.neuraldraft.io/errors/service_unavailable",
"title": "Service unavailable",
"status": 503,
"detail": "A required upstream service is temporarily unavailable. Retry in 5 seconds.",
"code": "service_unavailable",
"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.
Body
application/jsonmultipart/form-data
Example:
"A serene yoga studio at dawn, soft sage and linen tones, no people"
Example:
"photorealistic"
Available options:
1:1, 16:9, 9:16, 4:5, 4:3, 3:2 Optional. If provided, the image is also addressable by this key.
Example:
"hero.background"
Response
Image uploaded (multipart mode).
Show child attributes
Show child attributes