POST
/v1/file_linksCreate a file link
Creates a new file link for sharing the contents of a file without authentication. Supply file with the identifier of a file whose purpose supports file links, and optionally set expires_at or attach metadata. The response includes the downloadable URL and the link's expiration state.
- RetriesRetries up to 2×, 500ms backoff, 30s timeout.
- IdempotentThe SDK sends
Idempotency-Key, so a retried request is only applied once.
File link details, including the file to share and optional expiration, expansion, and metadata settings.
expandarray<string>optional
Specifies which fields in the response should be expanded.
expires_atintegeroptional
The link isn't usable after this future timestamp.
filestringrequired
The ID of the file. The file's `purpose` must be one of the following: `business_icon`, `business_logo`, `customer_signature`, `dispute_evidence`, `finance_report_run`, `financial_account_statement`, `identity_document_downloadable`, `issuing_regulatory_reporting`, `pci_document`, `selfie`, `sigma_scheduled_query`, `tax_document_user_upload`, `terminal_android_apk`, or `terminal_reader_splashscreen`.
metadataobjectoptional
Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
200Returns the created file link with its identifier, file reference, publicly accessible URL, creation time, expiration time, expiration state, livemode, metadata, and object type.
createdintegerrequired
Time at which the object was created. Measured in seconds since the Unix epoch.
expiredbooleanrequired
Returns if the link is already expired.
expires_atintegeroptional
Time that the link expires.
filestringrequired
The file object this link points to.
idstringrequired
Unique identifier for the object.
livemodebooleanrequired
If the object exists in live mode, the value is `true`. If the object exists in test mode, the value is `false`.
metadataobjectrequired
Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
objectstringrequired
String representing the object's type. Objects of the same type share the same value.
urlstringoptional
The publicly accessible URL to download the file.
defaultError response.
errorobjectrequired
Error handling
file is required and must identify an eligible file. expires_at must be a future Unix timestamp, and expand items must not exceed 5,000 characters; metadata must be key-value data or an empty string.