Tasks
Base URL: https://app.neuroflash.com/api/image-service
Generate images from a text prompt
POST
/v1/workspaces/{workspaceId}/image-generation-tasksGenerates a new image from the given prompt.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
workspaceId | string | Yes |
Request Body
FieldTypeRequiredDescription
promptstringYestext prompt to generate fromnumImagesintegerNohow many images to generateaspectRatiostringNoAspect ratio options for generated images.outputFormatstringNomodelIdstringNoAvailable image generation models.Response
FieldTypeDescription
imagesarray<object>the created images
idstringunique UUIDgenerationIdstringGroups every image produced by one generation request. Multiple rows can share the same generationId when a request asked for more than one image.workspaceIdstringowning workspace IDcreatedByUserIdstringuserId of the account that created this imagepromptstringprompt that produced the image (empty for upscales or uploads)modelstringmodel used to produce the imageparametersobjectgeneration parameters (aspect ratio, format, etc.)inputImageIdsobjectIDs of any input images supplied for edit-tasks or upscale-tasksfileNamestringHuman-readable filename (with extension) suitable for downloads. Uploads carry the user-supplied name; generations get an LLM-derived slug; edits/upscales suffix the input's name. Capped at 50 characters.imageWidthobjectimage width in pixelsimageHeightobjectimage height in pixelsimageSizeobjectimage file size in bytescreatedAtstringcreation timestamp as ISO 8601updatedAtstringlast update timestamp as ISO 8601shareKeystringHMAC key authorizing this image's public share link (pass as ?key=)_linksobject
contentstringtemporary url to the image binarydownloadstringtemporary url that forces a file download (content-disposition: attachment)generationIdstringID grouping the images that were created togetherdescriptionstringoptional description returned by the upstream providerdetailobjectnon-fatal warning (e.g. partial quota)Example
- cURL
- Python
- Node.js
- Go
curl -X POST "https://app.neuroflash.com/api/image-service/v1/workspaces/{workspace_id}/image-generation-tasks" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"prompt": "string",
"numImages": 1,
"aspectRatio": "string",
"outputFormat": "string",
"modelId": "string"
}'
import requests
response = requests.post(
f"https://app.neuroflash.com/api/image-service/v1/workspaces/{workspace_id}/image-generation-tasks",
headers={"Authorization": f"Bearer {token}", "Content-Type": "application/json"},
json={
"prompt": "string",
"numImages": 1,
"aspectRatio": "string",
"outputFormat": "string",
"modelId": "string"
},
).json()
const response = await fetch(
`https://app.neuroflash.com/api/image-service/v1/workspaces/${workspaceId}/image-generation-tasks`,
{
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"prompt": "string",
"numImages": 1,
"aspectRatio": "string",
"outputFormat": "string",
"modelId": "string"
}),
}
).then((r) => r.json());
body, _ := json.Marshal(map[string]any{
"prompt": "string",
"numImages": 1,
"aspectRatio": "string",
"outputFormat": "string",
"modelId": "string",
})
req, _ := http.NewRequest("POST", "https://app.neuroflash.com/api/image-service/v1/workspaces/"+workspaceID+"/image-generation-tasks", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer "+token)
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
Response:
{
"images": [
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"generationId": "string",
"workspaceId": "string",
"createdByUserId": "string",
"prompt": "string",
"model": "string",
"parameters": {},
"inputImageIds": {},
"fileName": "string",
"imageWidth": {},
"imageHeight": {},
"imageSize": {},
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:30:00Z",
"shareKey": "string",
"_links": {
"content": "string",
"download": "string"
}
}
],
"generationId": "string",
"description": "string",
"detail": {}
}
Edit existing images (prompt-driven image-to-image)
POST
/v1/workspaces/{workspaceId}/image-edit-tasksConsumes one or more existing image(s) and a prompt, and produces new image(s) derived from them.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
workspaceId | string | Yes |
Request Body
FieldTypeRequiredDescription
promptstringYesedit prompt that drives the image-to-image generationimageIdsarray<string>YesIDs of existing images to edit. The caller must own each image (same workspace and createdByUserId).numImagesintegerNohow many images to produceaspectRatiostringNoAspect ratio options including 'auto' for image-to-image edits.outputFormatstringNomodelIdstringNoAvailable image generation models.Response
FieldTypeDescription
imagesarray<object>the created images
idstringunique UUIDgenerationIdstringGroups every image produced by one generation request. Multiple rows can share the same generationId when a request asked for more than one image.workspaceIdstringowning workspace IDcreatedByUserIdstringuserId of the account that created this imagepromptstringprompt that produced the image (empty for upscales or uploads)modelstringmodel used to produce the imageparametersobjectgeneration parameters (aspect ratio, format, etc.)inputImageIdsobjectIDs of any input images supplied for edit-tasks or upscale-tasksfileNamestringHuman-readable filename (with extension) suitable for downloads. Uploads carry the user-supplied name; generations get an LLM-derived slug; edits/upscales suffix the input's name. Capped at 50 characters.imageWidthobjectimage width in pixelsimageHeightobjectimage height in pixelsimageSizeobjectimage file size in bytescreatedAtstringcreation timestamp as ISO 8601updatedAtstringlast update timestamp as ISO 8601shareKeystringHMAC key authorizing this image's public share link (pass as ?key=)_linksobject
contentstringtemporary url to the image binarydownloadstringtemporary url that forces a file download (content-disposition: attachment)generationIdstringID grouping the images that were created togetherdescriptionstringoptional description returned by the upstream providerdetailobjectnon-fatal warning (e.g. partial quota)Example
- cURL
- Python
- Node.js
- Go
curl -X POST "https://app.neuroflash.com/api/image-service/v1/workspaces/{workspace_id}/image-edit-tasks" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"prompt": "string",
"imageIds": [],
"numImages": 1,
"aspectRatio": "string",
"outputFormat": "string",
"modelId": "string"
}'
import requests
response = requests.post(
f"https://app.neuroflash.com/api/image-service/v1/workspaces/{workspace_id}/image-edit-tasks",
headers={"Authorization": f"Bearer {token}", "Content-Type": "application/json"},
json={
"prompt": "string",
"imageIds": [],
"numImages": 1,
"aspectRatio": "string",
"outputFormat": "string",
"modelId": "string"
},
).json()
const response = await fetch(
`https://app.neuroflash.com/api/image-service/v1/workspaces/${workspaceId}/image-edit-tasks`,
{
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"prompt": "string",
"imageIds": [],
"numImages": 1,
"aspectRatio": "string",
"outputFormat": "string",
"modelId": "string"
}),
}
).then((r) => r.json());
body, _ := json.Marshal(map[string]any{
"prompt": "string",
"imageIds": []any{},
"numImages": 1,
"aspectRatio": "string",
"outputFormat": "string",
"modelId": "string",
})
req, _ := http.NewRequest("POST", "https://app.neuroflash.com/api/image-service/v1/workspaces/"+workspaceID+"/image-edit-tasks", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer "+token)
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
Response:
{
"images": [
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"generationId": "string",
"workspaceId": "string",
"createdByUserId": "string",
"prompt": "string",
"model": "string",
"parameters": {},
"inputImageIds": {},
"fileName": "string",
"imageWidth": {},
"imageHeight": {},
"imageSize": {},
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:30:00Z",
"shareKey": "string",
"_links": {
"content": "string",
"download": "string"
}
}
],
"generationId": "string",
"description": "string",
"detail": {}
}
Upscale an existing image
POST
/v1/workspaces/{workspaceId}/image-upscale-tasksUpscales a single input image with a dedicated upscale model.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
workspaceId | string | Yes |
Request Body
FieldTypeRequiredDescription
imageIdstringYesID of the existing image to upscale. The caller must own the image (same workspace and createdByUserId).modelIdstringYesAvailable image upscaling models.upscaleFactorintegerYesSupported upscale factors.outputFormatstringNoResponse
FieldTypeDescription
imagesarray<object>the created images
idstringunique UUIDgenerationIdstringGroups every image produced by one generation request. Multiple rows can share the same generationId when a request asked for more than one image.workspaceIdstringowning workspace IDcreatedByUserIdstringuserId of the account that created this imagepromptstringprompt that produced the image (empty for upscales or uploads)modelstringmodel used to produce the imageparametersobjectgeneration parameters (aspect ratio, format, etc.)inputImageIdsobjectIDs of any input images supplied for edit-tasks or upscale-tasksfileNamestringHuman-readable filename (with extension) suitable for downloads. Uploads carry the user-supplied name; generations get an LLM-derived slug; edits/upscales suffix the input's name. Capped at 50 characters.imageWidthobjectimage width in pixelsimageHeightobjectimage height in pixelsimageSizeobjectimage file size in bytescreatedAtstringcreation timestamp as ISO 8601updatedAtstringlast update timestamp as ISO 8601shareKeystringHMAC key authorizing this image's public share link (pass as ?key=)_linksobject
contentstringtemporary url to the image binarydownloadstringtemporary url that forces a file download (content-disposition: attachment)generationIdstringID grouping the images that were created togetherdescriptionstringoptional description returned by the upstream providerdetailobjectnon-fatal warning (e.g. partial quota)Example
- cURL
- Python
- Node.js
- Go
curl -X POST "https://app.neuroflash.com/api/image-service/v1/workspaces/{workspace_id}/image-upscale-tasks" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"imageId": "string",
"modelId": "string",
"upscaleFactor": 0,
"outputFormat": "string"
}'
import requests
response = requests.post(
f"https://app.neuroflash.com/api/image-service/v1/workspaces/{workspace_id}/image-upscale-tasks",
headers={"Authorization": f"Bearer {token}", "Content-Type": "application/json"},
json={
"imageId": "string",
"modelId": "string",
"upscaleFactor": 0,
"outputFormat": "string"
},
).json()
const response = await fetch(
`https://app.neuroflash.com/api/image-service/v1/workspaces/${workspaceId}/image-upscale-tasks`,
{
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"imageId": "string",
"modelId": "string",
"upscaleFactor": 0,
"outputFormat": "string"
}),
}
).then((r) => r.json());
body, _ := json.Marshal(map[string]any{
"imageId": "string",
"modelId": "string",
"upscaleFactor": 0,
"outputFormat": "string",
})
req, _ := http.NewRequest("POST", "https://app.neuroflash.com/api/image-service/v1/workspaces/"+workspaceID+"/image-upscale-tasks", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer "+token)
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
Response:
{
"images": [
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"generationId": "string",
"workspaceId": "string",
"createdByUserId": "string",
"prompt": "string",
"model": "string",
"parameters": {},
"inputImageIds": {},
"fileName": "string",
"imageWidth": {},
"imageHeight": {},
"imageSize": {},
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:30:00Z",
"shareKey": "string",
"_links": {
"content": "string",
"download": "string"
}
}
],
"generationId": "string",
"description": "string",
"detail": {}
}