Skip to main content
If you’re working with an AI coding assistant (Cursor, Claude Code, Copilot, Windsurf, v0, etc.), the fastest way to integrate Runflow is to hand it a focused prompt describing the endpoint, its contract, and the tasks you want done. These prompts are copy-paste-ready — open them in your editor, pipe them into your agent, and review the generated code.
These prompts are endpoint contracts in prose form, not marketing copy. Keep them unedited when you paste — the agent follows the structure (endpoint, auth, request, response, tasks) closely.

Score Image

Use this prompt to have an agent wire up the synchronous Score Image endpoint — typically as a quality gate in front of photo uploads.
Score a portrait photo using the Runflow Score Image API.

Endpoint: POST https://api.runflow.io/api/v1/images/score
Auth header: x-api-key: <YOUR_API_KEY>

What it does:
Analyzes a portrait photo and returns a quality score (0.0–1.0), brightness and sharpness measurements, and actionable improvement tips. This is a synchronous endpoint — no webhook needed.

Request — two options:

Option A — File upload (multipart/form-data):
  - image  (file, required): the portrait image file (JPEG, PNG, WebP)

Option B — JSON body (application/json):
  - image_url  (string, required): a publicly accessible URL of the portrait image

Response:
{
  "quality_score": 0.8,    // 0.0 to 1.0 overall quality
  "brightness": 83.1,      // 0–100 scale
  "sharpness": 96.6,       // 0–100 scale
  "tips": ["..."]          // actionable suggestions to improve the photo
}

Tasks:
1. Create a function that calls this API, sending either an image file or a URL.
2. Use quality_score to gate photo acceptance (e.g. reject if below 0.6).
3. Surface the tips array to the user so they can retake the photo with better results.

Generate Headshots

Use this prompt to have an agent wire up the asynchronous Generate Headshots endpoint, including the webhook handler. This is the common “upload a few selfies, get 60 pro headshots back” flow.
Integrate the Runflow Generate Headshots API into our app.

Endpoint: POST https://api.runflow.io/api/v1/images/generate-headshots
Auth header: x-api-key: <YOUR_API_KEY>

What it does:
Accepts portrait photos and asynchronously generates 60 professional AI headshots. It responds immediately with a headshots_id, then POSTs a webhook to our callback_url when the images are ready (estimated 1–2 hours).

Request — two options:

Option A — File upload (multipart/form-data):
  - callback_url  (string, required): our webhook URL
  - images        (file[], required): one or more portrait image files

Option B — JSON body (application/json):
  - callback_url   (string, required): our webhook URL
  - input_images   (string[], required): array of public image URLs

Immediate response:
{
  "success": true,
  "data": {
    "headshots_id": "<uuid>"
  }
}

Webhook payload (POSTed to callback_url when done):
{
  "event": "headshots.completed",
  "headshots_id": "<uuid>",
  "image_urls": ["https://...", "https://...", ...]   // 60 images, expire in 24 hours
}

Tasks:
1. Create a backend function that calls this API. Pass a callback_url pointing to our webhook handler, and send either uploaded files or image URLs as input.
2. Save the headshots_id from the immediate response so we can match it to the webhook later.
3. Create a webhook handler at our callback_url that:
   - Checks event === "headshots.completed"
   - Saves headshots_id + image_urls to the database immediately (URLs expire in 24 hours)
   - Returns HTTP 200

Tips for working with AI agents on Runflow

  • Keep the prompts unedited. The endpoint, auth, request, response, and tasks sections are a deliberate contract shape that most agents follow closely. Trimming them leads to worse generated code.
  • Point the agent at the reference pages too (Score Image, Generate Headshots). The reference pages contain the exact schemas and the “Try it” playground, which helps the agent verify its own work.
  • Store headshots_id as the source-of-truth key on your side. The Runflow image_urls expire in 24 hours — they’re a delivery artifact, not a permanent identifier.
  • For local dev, use an ngrok tunnel as your callback_url so Runflow can reach your webhook handler from the public internet.

What’s next

Webhooks

The full async callback pattern and handler example.

Authentication

Key management and security best practices.