---
title: "Create a permanent, unauthenticated public URL for an existing file. The
underlying file is unaffected and can still be fetched through the
authenticated content endpoint. Use this when you want to share a stored
asset (image, video, PDF) outside your API-keyed environment. Public URLs
can be revoked at any time via `POST /v1/files/{file_id}/public-url/revoke`."
method: POST
path: "/v1/files/{file_id}/public-url"
tags: ["v1"]
---

# Create a permanent, unauthenticated public URL for an existing file. The
underlying file is unaffected and can still be fetched through the
authenticated content endpoint. Use this when you want to share a stored
asset (image, video, PDF) outside your API-keyed environment. Public URLs
can be revoked at any time via `POST /v1/files/{file_id}/public-url/revoke`.

`POST /v1/files/{file_id}/public-url`

## Path parameters

- `file_id` string, required

## Request body

- CreatePublicUrlRequest — Request body for `POST /v1/files/{file_id}/public-url`.
  - `expires_after` integer, nullable — Seconds from now until the public URL expires. Must be between `3600` (1 hour) and `2592000` (30 days). Omit to inherit the file's expiry (if it has one) or to make the URL valid indefinitely.

## Response `200`

Success

- CreatePublicUrlResponse — Response for creating a public URL for a file.
  - `expires_at` integer, nullable — Unix timestamp (seconds) when the public URL expires. Present when the public URL has an expiry, either from an explicit `expires_after` in the request or inherited from the file's TTL. Absent when the public URL is valid indefinitely.
  - `public_url` string, required — The full public URL.

## Other responses

- `400` — Bad request. Common causes: `expires_after` outside [3600, 2592000], `expires_after` greater than the file's remaining lifetime, unsupported content type, file is empty or larger than 50 MiB.
- `404` — File not found, deleted, or belongs to another team.
- `429` — Per-team active-URL quota exhausted (1000 max) or rate limit exceeded.

---

[API](https://skmtc.net/x/apis/xai-s-rest-api.md) · [All operations](https://skmtc.net/x/apis/xai-s-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/x/xai-s-rest-api/revisions/8f6014272113/schema)
