File Links

File links give you a revocable public URL for a stored file. Use them for product images or product videos that you want to embed in customer-facing surfaces.

The public open URL should be shown only to the people or systems that should have access.


A file link stores the sharing policy for one file. The public URL is returned when you create the link, then managed by you as a secret.

Properties

  • accessobjectAccess policy and audit fields for the link.Click or tap to expand
    • Name
      access_count
      Type
      integer
      Description
      Number of successful opens recorded for this link.
    • Name
      allow_download
      Type
      boolean
      Description
      Whether attachment-style delivery is allowed.
    • Name
      allowed_origins
      Type
      array
      Description
      Optional list of allowed origins.
    • Name
      last_accessed_at
      Type
      timestamp
      Description
      When the link was last opened successfully.
    • Name
      max_accesses
      Type
      integer
      Description
      Maximum number of successful opens allowed before the link stops working.
  • Name
    active
    Type
    boolean
    Description

    Whether the link can still be opened.

  • Name
    created_at
    Type
    timestamp
    Description

    When the link was created.

  • created_byobjectActor that created the link.Click or tap to expand
    • Name
      email
      Type
      string
      Description
      Actor email when available.
    • Name
      id
      Type
      string
      Description
      Actor ID when available.
    • Name
      name
      Type
      string
      Description
      Actor display name when available.
    • Name
      type
      Type
      string
      Description
      Actor type such as api_key or system.
  • Name
    custom_data
    Type
    object
    Description

    Optional string key-value custom data attached to the link.

  • deliveryobjectHow Commerce should serve the file when the link is opened.Click or tap to expand
    • Name
      content_type
      Type
      string
      Description
      Optional content type override for the response.
    • Name
      disposition
      Type
      string
      Description
      Response disposition, such as attachment or inline.
    • Name
      filename
      Type
      string
      Description
      Filename to present to the downloader.
    • Name
      mode
      Type
      string
      Description
      Delivery mode: download, inline, or redirect.
  • Name
    expires_at
    Type
    timestamp
    Description

    When the link stops granting access.

  • Name
    file_id
    Type
    string
    Description

    File ID the link grants access to.

  • Name
    id
    Type
    string
    Description

    Unique file-link identifier. File link IDs begin with flink_.

  • Name
    kind
    Type
    string
    Description

    Link kind. Currently public.

  • Name
    metadata
    Type
    object
    Description

    Service-generated metadata about the link. Read-only; use custom_data for caller-supplied data.

  • Name
    purpose
    Type
    string
    Description

    Purpose of the linked file:

    • product_image is linkable through this API.
    • product_video is linkable through this API.
    • product_download is not linkable through this API.
    • products_import is not linkable through this API.
    • support_document is not linkable through this API.
  • Name
    revoked_at
    Type
    timestamp
    Description

    When the link was revoked. Returned only after revocation.

  • revoked_byobjectActor that revoked the link. Present only after revocation.Click or tap to expand
    • Name
      email
      Type
      string
      Description
      Actor email when available.
    • Name
      id
      Type
      string
      Description
      Actor ID when available.
    • Name
      name
      Type
      string
      Description
      Actor display name when available.
    • Name
      type
      Type
      string
      Description
      Actor type such as api_key or system.
  • Name
    status
    Type
    string
    Description

    Link lifecycle status: active, revoked, expired, or disabled.

  • Name
    updated_at
    Type
    timestamp
    Description

    When the link was last updated.


Create a revocable public URL for a linkable file. Only product_image and product_video files can be exposed through file links; use Download file contents for private assets such as support documents and product downloads.

Each successful create returns a new link and bearer URL. Creation is intentionally not idempotent: do not attach an Idempotency-Key or automatically repeat the request after an uncertain response. Store the first successful url and file_link.id; use the ID to look up or revoke the link later.

Request body

  • accessobjectOptional access policy for the link.Click or tap to expand
    • Name
      allow_download
      Type
      boolean
      Description
      Whether download-style delivery is allowed.
    • Name
      allowed_ip_ranges
      Type
      array
      Description
      Optional list of allowed CIDR ranges. Enforced when the link is opened but not returned in responses.
    • Name
      allowed_origins
      Type
      array
      Description
      Optional list of allowed origins.
    • Name
      max_accesses
      Type
      integer
      Description
      Optional maximum successful open count.
  • created_byobjectOptional actor creating the link. Defaults to { "type": "api_key" }.Click or tap to expand
    • Name
      email
      Type
      string
      Description
      Actor email when available.
    • Name
      id
      Type
      string
      Description
      Actor ID when available.
    • Name
      name
      Type
      string
      Description
      Actor display name when available.
    • Name
      type
      Type
      string
      Description
      Actor type.
  • Name
    custom_data
    Type
    object
    Description

    Optional string key-value custom data for your own tracking. The encoded object can be at most 25 KiB, and each key can be at most 256 characters.

  • deliveryobjectOptional delivery settings for the link.Click or tap to expand
    • Name
      content_type
      Type
      string
      Description
      Optional content type override.
    • Name
      disposition
      Type
      string
      Description
      Optional disposition override. Use attachment or inline.
    • Name
      filename
      Type
      string
      Description
      Optional filename override.
    • Name
      mode
      Type
      string
      Description
      Delivery mode: download, inline, or redirect.
  • Name
    expires_at
    Type
    timestamp
    Description

    Optional RFC 3339 expiry. The default is 24 hours from creation.

  • Name
    file_id
    Type
    string
    Description

    Linkable file ID to expose.

Defaults and validation

  • expires_at must be in the future and defaults to 24 hours after creation.
  • Delivery mode defaults to download. Disposition defaults to inline for inline mode and attachment otherwise. If mode and disposition are both omitted, downloads are enabled by default.
  • attachment disposition requires access.allow_download: true. max_accesses must be nonnegative; 0 means unlimited successful opens.
  • content_type must use valid MIME syntax, and filename cannot contain HTTP control characters.
  • Every allowed origin must contain only a scheme and host, with no credentials, query, fragment, or non-root path. Every allowed IP range must be valid CIDR notation.

Response

The response returns a top-level file_link object and a top-level url. Lookup responses do not expose token material later.

Request

POST
/file_links/create
curl https://api.zebo.dev/file_links/create \
  -H "Authorization: Bearer $COMMERCE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "file_id": "file_4q6YcQk1RzPv2mDa8nFw0sHu",
    "delivery": { "mode": "inline" },
    "access": { "allow_download": true, "max_accesses": 100 },
    "expires_at": "2026-07-06T12:30:00Z"
  }'
{
  "file_link": {
    "id": "flink_8pQz3LkY6mN2vT9sB4cD1eF0",
    "kind": "public",
    "file_id": "file_4q6YcQk1RzPv2mDa8nFw0sHu",
    "purpose": "product_image",
    "status": "active",
    "active": true,
    "delivery": {
      "mode": "inline",
      "filename": "hero.png",
      "content_type": "image/png",
      "disposition": "inline"
    },
    "access": { "allow_download": true, "max_accesses": 100, "access_count": 0 },
    "created_by": { "type": "api_key" },
    "created_at": "2026-06-05T12:30:00Z",
    "updated_at": "2026-06-05T12:30:00Z",
    "expires_at": "2026-07-06T12:30:00Z"
  },
  "url": "<FILE_LINK_URL>"
}

Retrieve file-link details by ID. Lookup never returns the original bearer token or public URL.

Request body

  • Name
    id
    Type
    string
    Description

    File-link ID to retrieve.

Response

The response returns a top-level file_link object.

Request

POST
/file_links/lookup
curl https://api.zebo.dev/file_links/lookup \
  -H "Authorization: Bearer $COMMERCE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"id":"flink_8pQz3LkY6mN2vT9sB4cD1eF0"}'

List file links for the authorized application. Use filters to find links for one file or to audit active, revoked, expired, and disabled links.

Request body

  • Name
    file_id
    Type
    string
    Description

    Optional file ID filter.

  • Name
    page_number
    Type
    integer
    Description

    Page number to retrieve. Defaults to 1.

  • Name
    page_size
    Type
    integer
    Description

    Requested number of links per page. Defaults to 25 and is capped at 256.

  • Name
    status
    Type
    string
    Description

    Optional status filter: active, revoked, expired, or disabled.

Response

Links are returned newest first. The response returns a top-level page object with file_links, number, and size; size is the number of links returned, not the requested limit. An exhausted page returns file_links: [] and size: 0. Page numbers and sizes below 1 are normalized to their defaults.

Request

POST
/file_links/page
curl https://api.zebo.dev/file_links/page \
  -H "Authorization: Bearer $COMMERCE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"file_id":"file_4q6YcQk1RzPv2mDa8nFw0sHu","status":"active","page_number":1,"page_size":25}'

Revoke a link so its public URL can no longer serve the file. Revocation is the preferred response when a URL was shared with the wrong recipient or the file no longer belongs in a customer-facing surface.

Request body

  • Name
    id
    Type
    string
    Description

    File-link ID to revoke.

  • revoked_byobjectOptional actor revoking the link.Click or tap to expand
    • Name
      email
      Type
      string
      Description
      Actor email when available.
    • Name
      id
      Type
      string
      Description
      Actor ID when available.
    • Name
      name
      Type
      string
      Description
      Actor display name when available.
    • Name
      type
      Type
      string
      Description
      Actor type.

Response

The response returns the updated file_link object with status set to revoked.

Request

POST
/file_links/revoke
curl https://api.zebo.dev/file_links/revoke \
  -H "Authorization: Bearer $COMMERCE_API_KEY" \
  -H "Idempotency-Key: revoke-file-link-001" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "flink_8pQz3LkY6mN2vT9sB4cD1eF0",
    "revoked_by": { "type": "user", "id": "usr_support_123" }
  }'

Open is the public endpoint behind a file-link URL. It does not use API-key authentication; the id and token query parameters in the URL are the bearer capability.

Query parameters

  • Name
    id
    Type
    string
    Description

    Public file-link capability ID.

  • Name
    token
    Type
    string
    Description

    Bearer token paired with the capability ID.

Response

Use the complete URL returned by Create a file link unchanged. The API validates the token, active state, expiry, origin, client address, and access limit before delivery.

Stream or inline delivery returns 200 OK with the file bytes. Redirect delivery returns 302 Found with a short-lived download URL in the Location header. A successful open increments access.access_count only after the file stream or redirect is ready; delivery failures do not consume the access limit.

Access-policy failures return 403; an unknown link or invalid token returns 404; an inactive, expired, or exhausted link returns 410. Unreadable contents return 424, an unsupported stored representation returns 422, and a temporarily unavailable operation returns 503.

Request

GET
/file_links/open
curl "<FILE_LINK_URL>" \
  --output hero.png

Was this page helpful?