cURL (upload)
curl -X PUT https://api.neuraldraft.io/v1/images/hero.background \
-H "Authorization: Bearer ndsk_live_yourkey" \
-F "file=@hero.jpg"await nd.images.replaceFile("hero.background", fs.createReadStream("hero.jpg"));requests.put(
"https://api.neuraldraft.io/v1/images/hero.background",
headers={"Authorization": f"Bearer {key}"},
files={"file": open("hero.jpg", "rb")},
)<?php
$client->put('images/hero.background', [
'headers' => ['Authorization' => 'Bearer '.$key],
'multipart' => [['name' => 'file', 'contents' => fopen('hero.jpg','r')]],
]);{
"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",
"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/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
Replace an image
Three replacement modes:
- Upload —
multipart/form-datawith afilepart. Synchronous; returns the updatedImage. 1 credit (image_register). Max 10MB; jpg/jpeg/png/webp/gif/svg only. - Direct URL —
application/jsonwith{ url }. Synchronous; returns the updatedImage. 1 credit (image_register). - Regenerate —
application/jsonwith{ regenerate: true, prompt, ... }. Returns aJoband replaces the image when complete. 32 credits (image).
PUT
/
images
/
{key}
cURL (upload)
curl -X PUT https://api.neuraldraft.io/v1/images/hero.background \
-H "Authorization: Bearer ndsk_live_yourkey" \
-F "file=@hero.jpg"await nd.images.replaceFile("hero.background", fs.createReadStream("hero.jpg"));requests.put(
"https://api.neuraldraft.io/v1/images/hero.background",
headers={"Authorization": f"Bearer {key}"},
files={"file": open("hero.jpg", "rb")},
)<?php
$client->put('images/hero.background', [
'headers' => ['Authorization' => 'Bearer '.$key],
'multipart' => [['name' => 'file', 'contents' => fopen('hero.jpg','r')]],
]);{
"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",
"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/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.
Path Parameters
Image key (any URL-safe identifier).
Example:
"hero.background"
Body
multipart/form-dataapplication/json
Image file (jpg/jpeg/png/webp/gif/svg). Max 10MB.
Response
Image replaced synchronously (upload or url mode).
Show child attributes
Show child attributes
⌘I