banatie-service/docs/api/image-generation.rest

213 lines
5.3 KiB
ReStructuredText

@base = http://localhost:3000
@apiKey = bnt_71e7e16732ac5e21f597edc56e99e8c3696e713552ec9d1f44dfeffb2ef7c495
###############################################################################
# GENERATIONS
###############################################################################
### Create Generation
# Generate AI image with optional reference images and flow support
POST {{base}}/api/v1/generations
Content-Type: application/json
X-API-Key: {{apiKey}}
{
"prompt": "A majestic eagle soaring over snow-capped mountains",
"aspectRatio": "16:9",
"alias": "@eagle-hero",
"flowAlias": "@hero",
"autoEnhance": true,
"meta": {
"tags": ["demo", "nature"]
}
}
###
"flowId": "flow-uuid-here",
generationID: "e14e0cc1-b3bc-4841-a6dc-f42c842d8d86"
###
### List Generations
# Browse generation history with filters and pagination
GET {{base}}/api/v1/generations?limit=20&offset=0&status=success
X-API-Key: {{apiKey}}
### Get Generation by ID
# View complete generation details including output and reference images
GET {{base}}/api/v1/generations/e14e0cc1-b3bc-4841-a6dc-f42c842d8d86
X-API-Key: {{apiKey}}
### Retry Generation
# Recreate a failed generation with optional parameter overrides
POST {{base}}/api/v1/generations/e14e0cc1-b3bc-4841-a6dc-f42c842d8d86/retry
Content-Type: application/json
X-API-Key: {{apiKey}}
### Delete Generation
# Remove generation record and associated output image (soft delete)
DELETE {{base}}/api/v1/generations/generation-uuid-here
X-API-Key: {{apiKey}}
###############################################################################
# FLOWS
###############################################################################
### Create Flow
# Initialize a new generation chain/workflow
POST {{base}}/api/v1/flows
Content-Type: application/json
X-API-Key: {{apiKey}}
{
"meta": {
"name": "Product Images Campaign"
}
}
### List Flows
# Browse all flows with computed generation and image counts
GET {{base}}/api/v1/flows?limit=20&offset=0
X-API-Key: {{apiKey}}
### Get Flow by ID
# View flow metadata, aliases, and computed counts
GET {{base}}/api/v1/flows/flow-uuid-here
X-API-Key: {{apiKey}}
### List Flow Generations
# View all generations associated with this flow
GET {{base}}/api/v1/flows/flow-uuid-here/generations?limit=20
X-API-Key: {{apiKey}}
### List Flow Images
# View all images (generated and uploaded) in this flow
GET {{base}}/api/v1/flows/flow-uuid-here/images?limit=20
X-API-Key: {{apiKey}}
### Update Flow Aliases
# Add or update flow-scoped aliases for image referencing
PUT {{base}}/api/v1/flows/flow-uuid-here/aliases
Content-Type: application/json
X-API-Key: {{apiKey}}
{
"aliases": {
"@hero": "image-uuid-here",
"@background": "another-image-uuid"
}
}
### Delete Flow Alias
# Remove a single alias from flow's alias map
DELETE {{base}}/api/v1/flows/flow-uuid-here/aliases/@hero
X-API-Key: {{apiKey}}
### Delete Flow
# Remove flow (hard delete, generations and images remain)
DELETE {{base}}/api/v1/flows/flow-uuid-here
X-API-Key: {{apiKey}}
###############################################################################
# IMAGES
###############################################################################
### Upload Image
# Upload image with automatic database record creation and storage
POST {{base}}/api/v1/images/upload
X-API-Key: {{apiKey}}
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="file"; filename="image.png"
Content-Type: image/png
< ./path/to/image.png
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="alias"
@product-hero
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="flowId"
flow-uuid-here
------WebKitFormBoundary7MA4YWxkTrZu0gW--
### List Images
# Browse image library with optional filters
GET {{base}}/api/v1/images?limit=20&offset=0&source=generated
X-API-Key: {{apiKey}}
### Resolve Alias
# Lookup image by alias with technical → flow → project precedence
GET {{base}}/api/v1/images/resolve/@last?flowId=flow-uuid-here
X-API-Key: {{apiKey}}
### Get Image by ID
# View complete image metadata and details
GET {{base}}/api/v1/images/image-uuid-here
X-API-Key: {{apiKey}}
### Update Image Metadata
# Modify image metadata fields
PUT {{base}}/api/v1/images/image-uuid-here
Content-Type: application/json
X-API-Key: {{apiKey}}
{
"alias": "@new-alias",
"focalPoint": {
"x": 0.5,
"y": 0.3
},
"meta": {
"description": "Updated description"
}
}
### Assign Image Alias
# Set project-level alias for image referencing
PUT {{base}}/api/v1/images/image-uuid-here/alias
Content-Type: application/json
X-API-Key: {{apiKey}}
{
"alias": "@product-hero"
}
### Delete Image
# Mark image as deleted without removing from storage (soft delete)
DELETE {{base}}/api/v1/images/image-uuid-here
X-API-Key: {{apiKey}}
###############################################################################
# LIVE GENERATION
###############################################################################
### Generate with Prompt Caching
# Generate images with intelligent caching based on prompt hash
# Returns raw image bytes (not JSON)
GET {{base}}/api/v1/live?prompt=грузовик едет по горной дороге&aspectRatio=16:9
X-API-Key: {{apiKey}}