Make a link that opens a private port for a while

A share link is the port's URL with a grant signed by the cell (`?pod_share=…`), for this port only, until `expires_at`: 1 minute to 7 days, 24 hours by default.

POST/v1/sandboxes/{sandbox_id}/ports/{port}/share-links

A share link is the port's URL with a grant signed by the cell (?pod_share=…), for this port only, until expires_at: 1 minute to 7 days, 24 hours by default. Anyone holding it opens the port until then. Nothing is stored, so a link is revoked by making a new token (createPortToken) or resetting the port, which ends every link made before. Opening it gives a session cookie for the port's host, at most 12 hours and never past the link, and a redirect to the URL without the grant. Refused to all but the creator of a no_save sandbox (saves_refused).

A key with the sandboxes:write scope.

Request

curl -X POST "https://api.pod.mapier.ai/v1/sandboxes/sbx_3ahrz6dmv29gqy5ckt18fpx4b/ports/1/share-links" \
  -H "Authorization: Bearer $POD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"expires_in_s":86400}'

Parameters

NameInTypeRequiredWhat it is
sandbox_idpathstringYes
portpathintegerYesA TCP or UDP port number, 1 to 65535.
Idempotency-KeyheaderstringNoMakes a repeat of this call safe for 24 hours.

Body

FieldTypeRequiredWhat it is
expires_in_sintegerNo1 minute to 7 days, 24 hours by default. Default 86400. From 60 to 604800.

Answer

201. The link.

201
{
  "url": "https://app.example.com",
  "expires_at": "2026-11-23T12:00:00.000Z"
}
FieldTypeAlwaysWhat it is
urlstringYesThe port's URL with ?pod_share=…. A secret until it expires; never logged by Pod.
expires_atstringYesRFC 3339 in UTC with milliseconds, for example 2026-11-23T17:04:05.123Z.

Errors

The refusals this call is known for: invalid, saves_refused, not_found, in_other_cell. Any call can also answer unauthorized, rate_limited, unavailable or internal; the error list says what each means and when to send the call again.

In the SDKs

ClientCall
TypeScriptpod.ports.shareLink(sandboxId, port, { … })
Pythonpod.ports.share_link(sandbox_id, port, …)