Skip to main content
Use the destination option on POST /image/generate when you want each successful image uploaded to storage you control. By default, Mynth only stores images on the Mynth CDN — no destination is required. Skip destinations when the Mynth CDN URL (mynth_url) is enough, or when you re-upload from that URL yourself. Destinations are for output delivery. To send input images into generation, see Upload Input Images.

Pricing

Destination delivery is included with image generation. Mynth does not charge an extra fee for uploading to your destination. You still pay generation cost per successful image. Your storage provider may bill for storage and egress separately.

Create a destination

Create destinations in the destinations dashboard. That is the primary path for most teams.
  1. Open the destinations dashboard.
  2. Create a destination with a slug (name), provider credentials, and path config.
  3. Optionally run a test upload from the dashboard to verify credentials.
The slug is immutable after creation. It must match /^[a-z0-9-]+$/ (1–64 characters): lowercase letters, digits, and dashes only. Supported providers: Management API routes (/destinations) require OAuth login, not API keys. Use the dashboard, or create via REST after OAuth (see below).

Pass a destination on generate

Reference the destination by its slug:
Set a client-wide default with the SDK constructor or MYNTH_DESTINATION:
If the slug does not exist for your account, generate validation fails before the task is created.

Read delivery fields on the result

When a destination is requested, each successful image includes delivery fields. Success with url_template configured:
Without url_template, a successful destination upload still stores the object, but url is null. Read mynth_url (or build the public URL yourself from the resolved path). task.urls in the SDK only includes non-null url values. Prefer task.getImages() and read url / mynth_url / destination when you use destinations.

Handle delivery failure

Destination upload runs after the image is generated. Delivery failure does not fail generation. If destination upload fails:
  • The image result still has status: "success"
  • mynth_url still points at the Mynth CDN
  • url is null
  • destination is:
Error codes: Optional error fields: message, provider_response. Always check destination.status per image when you depend on your own storage.

Configure path and URL templates

When you create or update a destination, set: Mynth resolves path_template, uploads the file to that path, then builds url from url_template by substituting {path}. Double slashes in the resulting URL (except after https:) are collapsed to a single slash.

Path template tokens

Rules:
  • The output format extension is always appended (.webp, .png, or .jpg). Do not put the extension in path_template.
  • {meta.key} only substitutes string metadata values. Missing or non-string values become the literal text undefined.
  • Metadata keys in templates may use letters, digits, and underscores only: {meta.userId}, not {meta.user-id}.
Example:
With metadata: { "campaign": "spring" }, output.format: "webp", and image id img_abc, the object path becomes:
and url becomes:
Use Use Metadata when path templates need per-request string values via {meta.key}.

REST example

Generate with a destination (API key auth):
Creating a task does not return images immediately. Wait in the SDK, poll task endpoints, or use webhooks — see Async and polling. When the generate task completes, each successful image may include destination as shown above.

Create a destination via API (OAuth)

Management routes require OAuth, not an API key:
Other management endpoints (OAuth):

How destinations fit generation

  1. Mynth generates the image and post-processes it (output.format / quality).
  2. Mynth uploads the image to the Mynth CDN and, if destination was set, to your storage in parallel.
  3. The result sets mynth_url to the CDN URL.
  4. If destination upload succeeded, destination.status is "success" and url is the url_template result (or null without url_template).
  5. If destination upload failed, the image remains successful: url is null, mynth_url is still set, and destination reports the error.
Delivery runs once per successfully generated image in the same image.generate task. Completed generate webhooks include per-image destination when a destination was requested.