Generate images legacy
POST /v1/organisations/{organisation_id}/workspaces/{workspace_id}/apps/{app_id}/instances/{instance_id}/images Deprecated
Makes images from a description, optionally based on images in the space, with Google's or OpenAI's image model, and saves them to the space's "Generated images" folder, scanned like any upload.
Only the instance's own app token asks (the AI agents space's images app offers it to agents as a tool), and only a write app. The organisation's AI settings pick the model: a provider it allows, served in the EU while it keeps processing there; provider names one. The call runs on the installation's provider accounts and is billed in credits by the tokens the provider reports (source image_generation), within the plan's limits. The prompt is never logged.
Authentication
Send an API key, or an access token from your organisation’s identity provider, in the Authorization header. How API keys work
Scope the API key needs: files:write
Security schemes in the OpenAPI document: session_cookie (cookie __Host-ivy_session)bearer (bearer)api_key (bearer)
Parameters
-
organisation_idpathstringrequired -
workspace_idpathstringrequired -
app_idpathstringrequired -
instance_idpathstringrequired
Request body
application/json ImageGenerationRequest required
-
countinteger (int32)|nullHow many images, 1-4; one when absent.
minimum 0 -
promptstringrequiredWhat to draw: the subject, style, composition and any text the image shows; 1-4,000 characters.
-
providerAgentProvider|null -
reference_imagesstring[]Up to 4 file ids of PNG, JPEG or WebP images in the space to base the images on: a photo to edit or a style to follow.
-
sizeImageShape|null
Responses
-
The new image files, in the space's "Generated images" folder
-
unauthenticated -
usage_limit_reached,billing_restricted,service_identity_limit_reached -
insufficient_scope: only an app instance asks, with its own app token;forbidden: only awriteapp makes images, and only for a person who may add files to the space.no_image_provider: the organisation's AI settings allow no provider whose images this installation offers (in the EU while it keeps processing there).access_revoked: the app's principal lost access, or the space was archived, before the request ran -
Not the token's organisation or space, or a reference image that isn't in it
-
file_scanning: a reference image has no version that passed the malware scan yet -
storage_limit_reached: the organisation's storage has no room for the images (4 MB each), checked before the provider is called -
validation_failedwith thefieldandreason;image_refused: the provider's safety system declined the prompt, with its reason;unsupported_type,too_large: a reference image that isn't a PNG, JPEG or WebP of at most 20 MB -
rate_limited: the instance's requests per minute -
internal -
image_failed: the provider failed -
images_unavailable: this installation makes no images, the provider is busy, or it didn't answer in time; orunavailable: the database is briefly unavailable; retry afterRetry-Afterseconds
Error codes
Errors come back as an ErrorBody whose code is one of these.
- 401
unauthenticated - 402
usage_limit_reachedbilling_restrictedservice_identity_limit_reached - 403
insufficient_scopeforbidden - 404
not_foundgeneric code for this status - 409
file_scanning - 413
storage_limit_reached - 422
validation_failedimage_refusedunsupported_typetoo_large - 429
rate_limited - 500
internal - 502
image_failed - 503
images_unavailableunavailable
Examples
curl -X POST "$IVY_API_URL/v1/organisations/$ORGANISATION_ID/workspaces/$WORKSPACE_ID/apps/$APP_ID/instances/$INSTANCE_ID/images" \
-H "Authorization: Bearer $IVY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt":"string"}' import { client, generateImagesLegacy } from "@spacivapp/ivy-sdk";
client.setConfig({
baseUrl: process.env.IVY_API_URL,
headers: { Authorization: `Bearer ${process.env.IVY_API_KEY}` },
});
const { data, error, response } = await generateImagesLegacy({
path: { organisation_id: organisationId, workspace_id: workspaceId, app_id: appId, instance_id: instanceId },
body: {
prompt: "string"
},
}); {
"count": 0,
"prompt": "string",
"provider": "anthropic",
"reference_images": [
"string"
],
"size": "square"
} {
"images": [
{
"file_id": "file_123",
"name": "Ada Lovelace",
"path": "string"
}
],
"model": "string"
}