image-agent
Image Agent

Create Session

Create a new image agent session.

Creates a new session without sending a chat message. If an ad_id is provided, context is automatically loaded from the database and the ad's existing creative image (if any) is added to the workspace with an initial assistant message.

Request:

  • ad_id (optional): AdCampaignAd ID - automatically loads target_audience, product_info, brand_guidelines, intro_text, reference_images, and saphire_website_id from database
  • context (optional): Manual context override (only used if ad_id not provided)
  • saphire_website_id (optional): Saphire website ID (only used if ad_id not provided)

Response:

  • Complete session detail including workspace state and initial messages
post/api/v1/image-agent/sessions

Request

  • Base URL: https://api.trylapis.com (the document declares no server; this is the origin it was published from)
  • URL: https://api.trylapis.com/api/v1/image-agent/sessions
  • Auth: HTTP bearer

Request body

ad_idinteger nullable

AdCampaignAd ID - loads target_audience, product_info, brand_guidelines, intro_text, reference_images, and saphire_website_id automatically from database

manual_reference_generation_idinteger nullable

ManualReferenceGeneration ID - loads the generated image into workspace for editing. Mutually exclusive with ad_id.

saphire_website_idinteger nullable

Saphire website ID for image generation (only used if ad_id/manual_reference_generation_id not provided)

use_manual_referencesboolean nullable

Whether to use manual reference uploads for image generation

image_urlstring nullable

External image URL to initialize workspace with. Used for editing Meta ads or other external images.

meta_ad_idstring nullable

Meta Ad Library ad ID (ad_archive_id). When provided with image_url, creates a proper AdCampaignAd linked to the user's Meta ad.

Response

Successful Response

idinteger required
user_idinteger required
status'active' | 'completed' | 'archived' | 'disabled' required

Session status values.

contextobject nullable
saphire_website_idinteger nullable
ad_idinteger nullable

Source AdCampaignAd ID if context was loaded from database

manual_reference_generation_idinteger nullable

Source ManualReferenceGeneration ID if image was loaded from there

created_atstring date-time required
updated_atstring date-time required

Changes

No recorded changes to this operation across all 1 revision of this API.