Skip to content

Images

You add an image in one of two ways: send its public HTTPS URL as source_url on a create or update request, or upload a local file first and send the file_id it returns. With an external URL, Flint downloads the image during that request, checks it, and stores its own copy. The response returns a Flint-hosted url with the image's width and height, and buyers load the image from Flint from then on. Flint contacts your host only while your request runs, so the source can move, expire, or go offline afterward without breaking a checkout.

These fields take images:

ResourceFieldHolds
ProductsimagesUp to 8, in display order
Product variantsimagesUp to 8, replacing the product's images for that variant
BundlesimagesUp to 8
Subscription plansimagesUp to 8
Payment linksimage1, shown on the link's checkout page
Merchantlogo, icon1 each, used on checkout, receipts, and emails in every mode
Order line itemsimage1, an image Flint already hosts

How Flint handles an external image#

This is the flow when you send an external source_url. For images on your own machine, see Upload a local file.

Adding an image and showing it to a buyerResponse
Your backendFlintYour image hostBuyer1. create or update with source_url2. GET source_urlimage bytes3. check, strip metadata, storethe resource with its Flint url, width, and height4. load url on checkout or your storefront
  1. Your backend sends 1. create or update with source_url to Flint
  2. Flint sends 2. GET source_url to Your image host
  3. Your image host returns image bytes to Flint
  4. Flint sends 3. check, strip metadata, store to Flint
  5. Flint returns the resource with its Flint url, width, and height to Your backend
  6. Buyer sends 4. load url on checkout or your storefront to Flint
  • It happens inside your request. With an external source_url, there is no separate upload step, webhook, or processing status to poll. When the response arrives, the image is stored and ready, or the request failed and the resource didn't change.
  • The format stays the same. A JPEG stays a JPEG, and the same goes for PNG and WebP. Flint removes embedded metadata, such as camera details and GPS location, before storing the image.
  • An unchanged source isn't downloaded again. On an update, if a source_url exactly matches the one that produced an image still attached to the same field of the same resource, Flint keeps that image without contacting your host. See Replace an image behind the same URL.
  • Identical images share a URL. If the bytes downloaded from an external source_url match an image you already added in the same mode or sandbox, Flint returns that image's url rather than storing a second copy, even when the source_url differs. This doesn't apply to local file uploads, which each get their own file_id and url, even when the bytes are identical.

Add images to a product#

You need an API key that can write products. This request creates a product with two images; the first one is the primary image:

cURL
curl -X POST https://api.withflintpay.com/v1/products \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: product-travel-mug-001" \
  -d '{
    "variant_mode": "simple",
    "name": "Travel mug",
    "product_type": "physical",
    "default_variant": {
      "unit_price_money": {"amount": 2800, "currency": "USD"}
    },
    "images": [
      {
        "source_url": "https://developers.withflintpay.com/examples/travel-mug-front.jpg",
        "alt": "Front view of a matte black travel mug",
        "source_reference": "media_8421"
      },
      {
        "source_url": "https://developers.withflintpay.com/examples/travel-mug-open.png",
        "alt": "Travel mug with the lid open",
        "source_reference": "media_8422"
      }
    ]
  }'

Flint responds with 201 Created. Abridged:

Response
{
  "data": {
    "product_id": "prod_01M4VJ7NAZDEN74V4V31X44TG4",
    "name": "Travel mug",
    "version": 1,
    "images": [
      {
        "url": "https://images.withflintpay.com/canonical/mer_01KJZT86DXN184KEX4XNJHNXP7/live/img_3H5YCG76HTQN4NAZ6AA30966DY/original.jpg",
        "alt": "Front view of a matte black travel mug",
        "source_reference": "media_8421",
        "width": 1600,
        "height": 1200
      },
      {
        "url": "https://images.withflintpay.com/canonical/mer_01KJZT86DXN184KEX4XNJHNXP7/live/img_0YGES5CBYTXMBECWS93MFP3C11/original.png",
        "alt": "Travel mug with the lid open",
        "source_reference": "media_8422",
        "width": 1600,
        "height": 1200
      }
    ]
  }
}

Each item in an images array, and each image, logo, or icon, takes these fields. Send exactly one of source_url and file_id; sending both, or neither, fails with 400 INVALID_REQUEST.

source_urlstring

Where Flint downloads the image: an HTTPS URL of up to 8,192 characters that meets the source requirements. Signed URLs with query strings work, as long as the signature is valid while your request runs. Flint never returns source_url or includes it in an error message. You can also send a url Flint returned earlier, to reuse that image without downloading anything.

file_idstring

The ID of a ready file you uploaded, beginning with file_. Flint attaches the file without downloading anything.

altstring

Alternative text for screen readers, up to 512 characters. Flint's checkout uses it, and treats an image without alt as decorative. Describe what a buyer would otherwise miss, such as the color or the item's contents.

source_referencestring

Your own reference for the image, such as the asset ID in your media library: 1 to 255 characters. Flint returns it on the image and doesn't interpret it. Spaces and letter case are kept exactly as you send them, so Front and front are different references. It's the stable value to compare when you sync images, since a signed source_url changes every time you sign it.

Within one gallery, each source_url, each file_id, and each source_reference must be unique.

Images on products, variants, bundles, subscription plans, payment links, and the merchant come back with url, width, height, and, when set, alt and source_reference. An image that is a Flint file also includes its file_id, however you attached it. Images on order line items, invoices, public payment links, and other buyer-facing responses return only url, alt, width, and height, so your source_reference and file IDs stay out of them.

Upload a local file#

Use a file upload when the image isn't on a public HTTPS host. You upload the bytes to Flint, then attach the file to the resource by its file_id. The Files reference lists every field and status.

  1. Create the file with POST /v1/files. Send the purpose (product, product_variant, bundle, payment_link, subscription_plan, merchant_logo, or merchant_icon), the exact content_type (image/jpeg, image/png, or image/webp), and size_bytes from 1 to 5,242,880.
  2. The 201 response returns a file_id that begins with file_, status awaiting_upload, and an upload object. PUT the bytes to upload.url with every header in upload.headers, exactly as returned. The upload URL expires at upload.expires_at, 15 minutes after creation.
  3. Call POST /v1/files/{file_id}/complete with no body. The 200 response returns the file with status ready and its Flint url, width, and height. If you call it before the bytes arrive, you get 409 ACTION_NOT_ALLOWED with reason status_not_reached and the file stays awaiting_upload, so you can finish the upload and complete it again.
  4. Pass the ready file's file_id in the image field instead of a source_url. Flint attaches it without downloading anything.
cURL
curl -X POST https://api.withflintpay.com/v1/files \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "purpose": "product",
    "content_type": "image/png",
    "size_bytes": 48213
  }'

Attach the file when you create or update the resource:

cURL
curl -X PATCH https://api.withflintpay.com/v1/products/prod_01M4VJ7NAZDEN74V4V31X44TG4 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "expected_version": 2,
    "images": [
      {
        "file_id": "file_01J00000000000000000000000",
        "alt": "Travel mug on a desk",
        "source_reference": "upload_5531"
      }
    ]
  }'

An unattached ready file can be attached until its expires_at, 24 hours after it becomes ready. Attaching it removes that deadline. If you remove the image from everything it was attached to, you have 7 days to attach it again.

Call GET /v1/files/{file_id} to check a file at any time. It returns the file's status (awaiting_upload, processing, ready, failed, or expired), a failure_code when it failed, and expires_at while a deadline applies. It never returns the upload URL, so to retry an upload that expired or failed, create a new file.

If a file isn't ready, attaching it fails with 409 ACTION_NOT_ALLOWED with reason terminal_status; read the file to see whether to complete it or upload a new one. An unknown file, or one from another merchant or environment, returns 404 RESOURCE_NOT_FOUND with param such as images[0].file_id.

These checks apply to a new write. Retrying a committed write with the same request and Idempotency-Key returns its original result, even if the file or image can no longer be attached.

To recover a lost response, send an Idempotency-Key on POST /v1/files and repeat the request with the same key. Without a key, create another file; the unused upload expires after 15 minutes. Both write routes accept the key, and a replay returns the original result and keeps the original deadlines.

  • Each upload is its own file. Uploading the same bytes twice returns two different file_id and url values.
  • Formats and size. Only JPEG, PNG, and WebP images up to 5 MB are accepted, the same as for external URLs.
  • Scope depends on purpose. You need the write scope for the resource, such as commerce.products.write for product, to create and complete a file, and its read or write scope to read one. Files for merchant_logo and merchant_icon need merchants.profile.write and a live-mode credential or a Dashboard session in any selected environment. Creating or completing them with a test credential returns 403 FORBIDDEN with reason live_mode_required. Partner installs cannot be granted the profile scope; a live install credential gets 403 INSUFFICIENT_SCOPE with a scope_requirement. Other file purposes remain writable in their own environment.
  • Environment. Logos and icons apply to the whole merchant, including from a sandbox. Other files belong to the mode or sandbox that created them.
  • Purpose and destination. A merchant_logo file attaches only as the logo, and a merchant_icon file only as the icon. The other purposes attach to any product, variant, bundle, plan, or payment link image.

Show images to buyers#

Use url exactly as returned, and store it if you render images from your own database. Flint image URLs are permanent: the bytes behind a URL never change, so they're served with a one-year immutable cache header. A different image always gets a different URL.

HTML
<img
  src="https://images.withflintpay.com/canonical/mer_01KJZT86DXN184KEX4XNJHNXP7/live/img_3H5YCG76HTQN4NAZ6AA30966DY/original.jpg"
  width="1600"
  height="1200"
  alt="Front view of a matte black travel mug"
  style="max-width: 100%; height: auto"
>

Setting width and height from the response lets the browser reserve space before the image loads, so your layout doesn't jump. The URL serves the stored image at its full size and doesn't accept resizing parameters. Size it with CSS, and don't upload images much larger than your storefront displays them. Don't build or edit Flint image URLs; their paths can change.

images on a product, variant, bundle, or subscription plan always holds the complete gallery. Each update replaces the whole array, so there's no call to add or remove one image. Send the full array you want, in display order, along with the resource's current version as expected_version:

ToSend
Leave the gallery as it isLeave images out. expected_version isn't needed.
Replace itEvery image you want, in order. The first is the primary image.
Reorder it, or change altEvery image in the new order. Send the same source_url you sent before, or the Flint url or file_id of the image, so nothing is downloaded.
Remove one imageEvery other image.
Clear it"images": []
cURL
curl -X PATCH https://api.withflintpay.com/v1/products/prod_01M4VJ7NAZDEN74V4V31X44TG4 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "expected_version": 1,
    "images": [
      {
        "source_url": "https://images.withflintpay.com/canonical/mer_01KJZT86DXN184KEX4XNJHNXP7/live/img_0YGES5CBYTXMBECWS93MFP3C11/original.png",
        "alt": "Travel mug with the lid open",
        "source_reference": "media_8422"
      },
      {
        "source_url": "https://images.withflintpay.com/canonical/mer_01KJZT86DXN184KEX4XNJHNXP7/live/img_3H5YCG76HTQN4NAZ6AA30966DY/original.jpg",
        "alt": "Front view of a matte black travel mug",
        "source_reference": "media_8421"
      }
    ]
  }'

This swaps the two images without downloading either. The response has the same URLs in the new order. Abridged:

Response
{
  "data": {
    "product_id": "prod_01M4VJ7NAZDEN74V4V31X44TG4",
    "version": 2,
    "images": [
      {
        "url": "https://images.withflintpay.com/canonical/mer_01KJZT86DXN184KEX4XNJHNXP7/live/img_0YGES5CBYTXMBECWS93MFP3C11/original.png",
        "alt": "Travel mug with the lid open",
        "source_reference": "media_8422",
        "width": 1600,
        "height": 1200
      },
      {
        "url": "https://images.withflintpay.com/canonical/mer_01KJZT86DXN184KEX4XNJHNXP7/live/img_3H5YCG76HTQN4NAZ6AA30966DY/original.jpg",
        "alt": "Front view of a matte black travel mug",
        "source_reference": "media_8421",
        "width": 1600,
        "height": 1200
      }
    ]
  }
}
  • expected_version is required whenever images is in an update. Without it, the request fails with 400 INVALID_REQUEST. If the resource changed since you read it, or an image write lost a race with another write, the request fails with 409 VERSION_CONFLICT. details[0].current_version is the version Flint saw, which can equal the one you sent after a lost race. Read the resource again, rebuild the request, and send it with a new Idempotency-Key.
  • Variant updates also change the product's version. Read the product again after updating one of its variants and before updating the product's own gallery.
  • An unchanged gallery changes no images. If the gallery you send matches the current one, Flint keeps the same images and doesn't record an image change. The update still follows the resource's usual rules, such as advancing version where it has one.
  • Variant galleries are set on the variant with PATCH /v1/products/{product_id}/variants/{variant_id}, which has its own version.

You can change a gallery while the item is on sale, in an open order or checkout, or part of a payment link, subscription plan, or subscription. Orders, invoices, subscription plans, and subscriptions keep the image they already have, and new checkouts show the new one.

Replace an image behind the same URL#

Flint treats a source_url as naming fixed content. When an update repeats the exact source_url of an image that is still attached to that field, Flint keeps the image and doesn't download the URL again, even if the bytes behind it have changed. The match is on the exact string, including the query string, and only against the same field of the same resource: a product's images and a variant's images are separate fields.

To replace the bytes behind a stable URL, send a different URL, such as one with a version query parameter (travel-mug-front.jpg?v=2), or upload a file. A signed URL changes each time you sign it, so Flint downloads it again.

A payment link's image and the merchant's logo and icon hold one image each. Unlike a gallery, they don't need expected_version. Send it anyway, with the version you read, to detect a concurrent edit to the link or the merchant profile:

  • Leave the field out to keep the current image.
  • Send an image object to replace it.
  • Send null to remove it.

Update logo and icon with PATCH /v1/merchant. They belong to your whole account, so the same logo and icon appear in live mode and every sandbox, and require a live-mode credential or a Dashboard session in any selected environment. A test credential cannot set or clear them and gets 403 FORBIDDEN with reason live_mode_required. A logo URL only works as a logo, and an icon URL only as an icon. An icon must be square and at least 128 by 128 pixels; anything else fails with 400 INVALID_REQUEST and detail code INVALID_VALUE.

Variant images#

A variant either shows its product's images or replaces them with its own:

what you set

images

The variant's own gallery. Empty means the variant uses the product's images. Read and write this field when you sync your catalog.

what buyers see

effective_images

The gallery to display: the variant's own images if it has any, otherwise the product's. images_inherited is true when they come from the product. Render this field in your storefront.

A variant gallery replaces the product's images completely; the two are never combined. To return a variant to the product's images, update the variant with "images": [] and its expected_version.

Images on orders, invoices, and subscriptions#

When an order includes a catalog item, its line item image is the item's primary image at that moment: the first of the variant's effective_images, or of the bundle's images. Subscription line items work the same way, and invoices show their order's line items. The line item keeps that image, so later catalog changes don't alter orders, invoices, or subscriptions that already exist. These images return only url, alt, width, and height.

A line item you describe yourself, without a variant_id or bundle_id, can show an image Flint already hosts. Pass its url in image:

JSON
{
  "type": "custom",
  "name": "Engraving",
  "quantity": 1,
  "unit_price_money": {"amount": 500, "currency": "USD"},
  "fulfillment": {"requirement": "none"},
  "tax": {"taxable": false},
  "image": {
    "url": "https://images.withflintpay.com/canonical/mer_01KJZT86DXN184KEX4XNJHNXP7/live/img_3H5YCG76HTQN4NAZ6AA30966DY/original.jpg",
    "alt": "Engraved travel mug"
  }
}

Creating an order never downloads an image. Any other URL fails with 400 INVALID_REQUEST and detail code NOT_ALLOWED. To show an image that Flint doesn't host yet, add it to a product, bundle, plan, or payment link first, then use the url from that response.

Reuse an image without downloading it again#

Anywhere an image field takes source_url, you can send a url Flint returned instead. Flint looks the image up and attaches it without contacting any outside host, so the request is faster, and repeated requests can't fail because of your image host. Use this to copy an image from one resource to another. Send the url exactly as returned.

The url must come from the same mode or sandbox: a sandbox image can't be used in live mode, and one merchant can't use another's images. To attach an image you uploaded, send its file_id instead.

An image stays reusable while it's attached anywhere, including to an order. Once you remove it from everything, you have 7 days to attach it again, and its URL keeps loading for buyers during that time. After that, the request fails with 409 ACTION_NOT_ALLOWED with reason terminal_status; send the original source_url again. An unknown URL, or one from another mode, sandbox, or merchant, fails with 404 RESOURCE_NOT_FOUND, with param naming the image field.

Keep images in sync with your catalog#

If your products live in another system, such as a PIM or an ecommerce platform, a sync can resend the stable URLs of images that didn't change: Flint doesn't download an image again while its exact source_url is still attached to the field. A signed URL is different each time, so it is downloaded again. Your sync decides when to skip a request and which URL to send:

  1. Save your media ID as the source_reference of each image you add.
  2. On each sync, build the gallery from your media records in display order, with each record's ID as source_reference.
  3. If the gallery's order, source_reference values, and alt text all match what Flint has, and no image changed, skip the request.
  4. Otherwise, send the full gallery with the version you last read as expected_version. For an image that didn't change, send the same source_url as last time. If your URLs are signed, each signature is a different URL that Flint downloads again, so send the saved Flint url of unchanged images instead. Send your own URL for new images. For an image whose bytes changed, send a new URL (see Replace an image behind the same URL). On 409 VERSION_CONFLICT, read the resource again and repeat from step 2.
JavaScript
// mediaRecords: your images for one product, in display order, each with
//   { id, url, altText, changedSinceLastSync }.
// product: the product as Flint last returned it.
// Returns the PATCH body, or null when nothing changed.
function galleryUpdate(mediaRecords, product) {
  const inFlint = new Map(
    product.images.map((image) => [image.source_reference, image]),
  );

  const unchanged =
    mediaRecords.length === product.images.length &&
    mediaRecords.every((media, i) => {
      const current = product.images[i];
      return (
        !media.changedSinceLastSync &&
        media.id === current.source_reference &&
        (media.altText ?? "") === (current.alt ?? "")
      );
    });
  if (unchanged) return null;

  const images = mediaRecords.map((media) => {
    const existing = inFlint.get(media.id);
    const reuse = existing && !media.changedSinceLastSync;
    return {
      // Flint's own url is never downloaded again, even when yours is signed.
      source_url: reuse ? existing.url : media.url,
      alt: media.altText ?? undefined,
      source_reference: media.id,
    };
  });

  return { expected_version: product.version, images };
}

One request can download at most 32 images from outside hosts, with no more than 100 megapixels in total. Flint downloads them a few at a time, and the request fails with 504 REQUEST_TIMEOUT if they take more than 30 seconds altogether. To bring in a large catalog, send each product's images in its own request.

Source requirements#

Flint checks each external source_url and the image it returns. The URL, redirect, and response rows apply only to external URLs. Local file uploads accept the same formats and the same 5 MB limit.

RequirementLimit
URLhttps:// on port 443. No user name or password, no #fragment, and a hostname rather than an IP address.
RedirectsUp to 3, each to a URL that meets the same rules.
ResponseA 2xx with the image bytes, uncompressed (no Content-Encoding), within 10 seconds including redirects.
FormatJPEG, PNG, or WebP. Animated PNG and WebP images and GIFs aren't supported.
File size5 MB
Dimensions1 to 12,000 pixels on each side, and at most 40 megapixels
Per request32 images from outside hosts, 100 megapixels in total

Flint requests images with the user agent Flint-Image-Ingestion/2.0. If your image host blocks automated traffic, allow that user agent.

Handle errors#

Image errors use the standard error envelope. error.param points to the exact field, such as images[1].source_url or variants[3].images[0].source_url. When several images fail in one request, error.details lists each one. If an invalid image and a source timeout occur together, the response is 400 INVALID_REQUEST with one INVALID_VALUE detail per failed image. The error and every detail have retry none, including the timeout detail. Correct the invalid images, then send the request with a new key.

To decide whether to retry, read error.remediation:

  • 409 ACTION_NOT_ALLOWED with details[0].reason image_ingestion_restart_required: this attempt is over, and resending the same Idempotency-Key replays the same error. Fix the cause if the error names one, then send the request with a new key, or without one.
  • retry is same_request with no such action: retry the same request with the same key after Retry-After or a short wait. IDEMPOTENCY_KEY_IN_PROGRESS means an earlier request with that key is still downloading the image.
  • retry is none: fix the request before sending it again.

A failed download always ends its attempt, even when the cause is temporary, such as your host being down. Retry those with a new key once the host recovers.

Fix the request#

These fail before Flint downloads anything. Each is 400 INVALID_REQUEST, and error.param and details[].param name the image field. The detail code is INVALID_VALUE unless noted. Send the corrected request with a new Idempotency-Key.

  • HTTP 400
    source_url is empty, longer than 8,192 characters, not HTTPS on port 443, or includes a user name, password, or fragment. source_url points to a private or internal host. A gallery has more than 8 images. The request includes more than 32 images from outside hosts: split it into several requests. The same source_url, file_id, or source_reference appears twice in one gallery. alt is longer than 512 characters. source_reference is empty or longer than 255 characters. A Flint image URL was changed, for example with a query string: send it exactly as Flint returned it. An update includes images without expected_version (REQUIRED). An image has neither source_url nor file_id (REQUIRED), or has both (NOT_ALLOWED). An order line item's image.url isn't a Flint image URL (NOT_ALLOWED)
  • HTTP 404
    The Flint image URL or file_id doesn't exist, or belongs to another mode, sandbox, merchant, or image field, such as a logo file used on a product. param names the field.
  • HTTP 409
    With reason terminal_status, a Flint image URL is past its reuse window: send the original source_url instead. A file_id can't be attached because the file isn't ready: read the file to see whether to complete it, or to upload a new one if it failed or expired. param names the field.

Fix the image#

Flint downloaded the source, but couldn't use it. Each is 400 INVALID_REQUEST with detail code INVALID_VALUE, and param names the image field. Fix the source, then retry with a new Idempotency-Key.

  • HTTP 400
    Your host returned a 4xx status, a compressed or empty body, a body that doesn't match its Content-Length, or too many redirects. The file is larger than 5 MB. The file isn't a JPEG, PNG, or WebP image, or it is damaged and can't be decoded: a GIF or an HTML error page fails this way, so fix the file before sending it again. The PNG or WebP image is animated: export a still frame. A side is longer than 12,000 pixels, or the image is larger than 40 megapixels. The icon isn't square, or is smaller than 128 by 128 pixels. With its metadata removed, the stored image would be larger than 10 MB: export it at a smaller size. The images in one request add up to more than 100 megapixels: split it into several requests

Retry#

  • HTTP 502
    EXTERNAL_SERVICE_ERRORRetry the same request
    Your host returned a 5xx status or couldn't be reached. Retry the same request with the same key after the host recovers.
  • HTTP 504
    REQUEST_TIMEOUTRetry the same request
    Your host didn't send the whole image within 10 seconds, the request ran out of time, or Flint couldn't process the image in time. Retry the same request with the same key.
  • HTTP 409
    IDEMPOTENCY_KEY_IN_PROGRESSRetry the same request
    An earlier request with this key is still downloading the image. Retry with the same key.
  • HTTP 409
    With reason image_ingestion_restart_required and retry none, this ingestion attempt is over. Another request may have finished first, the earlier attempt may have expired, or processing may have ended in failure. Start a new ingestion with a new key.
  • HTTP 503
    SERVICE_UNAVAILABLERetry the same request
    Image processing is temporarily unavailable or failed. Retry the same request with the same key after a short wait.
  • HTTP 500
    INTERNAL_ERRORRetry the same request
    Flint couldn't process the image. Retry the same request with the same key.
  • HTTP 409
    With reason image_storage, your account's image storage is full. Don't retry in a loop. details[0].quota reports bytes used and reserved and, when available, next_expiration_at, when storage held by an unused image will free up. Remove images you no longer need, or wait until then.

Conflicts#

A missing image, or one outside the merchant or environment of the attachment request, returns 404 RESOURCE_NOT_FOUND with details[0].resource_type set to image and no resource_id. When the image or the resource receiving it exists but its state refuses attachment, the response is 409 ACTION_NOT_ALLOWED with reason unsupported_state and its actual current_status. Read that state before choosing another action.

  • HTTP 409
    VERSION_CONFLICTRefresh, then retry
    The resource changed after you read it, or an image write lost a race with another write. details[0].current_version is the version Flint saw. Read the resource again, rebuild the request, and send it with a new Idempotency-Key.

Errors lists every code with its remediation.

Sandboxes and live mode#

Images belong to the mode or sandbox they were added in, except the merchant logo and icon, which apply everywhere. Files follow the same rule. When you copy catalog data from one environment to another, images aren't copied. Add them again in the target environment, using the original source_url values or new files.

Endpoints#

  • POST/v1/filesRequired API key scopes: checkouts.payment_links.write, commerce.bundles.write, commerce.products.write, commerce.subscription_plans.write or merchants.profile.writeReference for POST /v1/files

    Create a file and get a signed URL to upload a local image.

  • POST/v1/files/{file_id}/completeRequired API key scopes: checkouts.payment_links.write, commerce.bundles.write, commerce.products.write, commerce.subscription_plans.write or merchants.profile.writeReference for POST /v1/files/{file_id}/complete

    Mark an uploaded file ready and get its Flint url.

  • GET/v1/files/{file_id}Required API key scopes: checkouts.payment_links.read, checkouts.payment_links.write, commerce.bundles.read, commerce.bundles.write, commerce.products.read, commerce.products.write, commerce.subscription_plans.read, commerce.subscription_plans.write, merchants.profile.read or merchants.profile.writeReference for GET /v1/files/{file_id}

    Read a file's status, failure_code, and expires_at.

  • POST/v1/productsRequired API key scope: commerce.products.writeReference for POST /v1/products

    Create a product with images, and variants with their own images.

  • PATCH/v1/products/{product_id}Required API key scope: commerce.products.writeReference for PATCH /v1/products/{product_id}

    Replace a product's gallery.

  • PATCH/v1/products/{product_id}/variants/{variant_id}Required API key scope: commerce.products.writeReference for PATCH /v1/products/{product_id}/variants/{variant_id}

    Replace or clear a variant's gallery. POST /v1/products/{product_id}/variants creates a variant with one.

  • PATCH/v1/bundles/{bundle_id}Required API key scope: commerce.bundles.writeReference for PATCH /v1/bundles/{bundle_id}

    Replace a bundle's gallery. POST /v1/bundles creates a bundle with one.

  • PATCH/v1/subscription-plans/{subscription_plan_id}Required API key scope: commerce.subscription_plans.writeReference for PATCH /v1/subscription-plans/{subscription_plan_id}

    Replace a plan's gallery. POST /v1/subscription-plans creates a plan with one.

  • PATCH/v1/merchantRequired API key scope: merchants.profile.writeReference for PATCH /v1/merchant

    Replace or remove your logo and icon.

  • POST/v1/ordersRequired API key scope: commerce.orders.writeReference for POST /v1/orders

    Create an order whose custom line items show Flint-hosted images.

Next steps#

Was this helpful?