---
title: "An entry link for an exposed port [write]"
method: POST
path: "/sessions/{id}/ports/{port}/grants"
---

# An entry link for an exposed port \[write\]

`POST /sessions/{id}/ports/{port}/grants`

## Request

- Base URL: `https://api.agentsky.dev/v1`
- URL: `https://api.agentsky.dev/v1/sessions/{id}/ports/{port}/grants`
- Auth: HTTP bearer

For a private port: a single-use link, good for a minute, that signs the browser opening it in to the port's origin (a cookie that lives twelve hours) and lands on `path`; minting again supersedes the previous unused link. For a public port: the plain address. An archived session answers 400 session_archived.

## Path parameters

- `id` string, required
- `port` integer, required

## Request body

- SessionPortGrantRequest
  - `path` string: Where on the app to land after entering; a path on the port's origin, default /

## Response `200`

OK

- SessionPortGrant
  - `url` string, required: A private port: a single-use entry link, good for a minute; a public port: the plain address
  - `expires_at` string, date-time, nullable, required

## Other responses

- `default`: Error — { error: { code, message, request_id } }

## Changes

- **2026-11-02** `e5e8f0229a99`: 4 info
  - added the optional property `error/request_id` to the response with the `default` status
  - the response property `error` became required for the status `default`
  - the response property `error/code` became required for the status `default`
  - the response property `error/message` became required for the status `default`

[Operation history](https://skmtc.dev/agentsky/apis/agentsky-developer-api/changes/sessions/:id/ports/:port/grants/post.md)

---

[API](https://skmtc.dev/agentsky/apis/agentsky-developer-api.md) - [All operations](https://skmtc.dev/agentsky/apis/agentsky-developer-api/llms.txt) - [OpenAPI document](https://skmtc.dev/agentsky/apis/agentsky-developer-api/revisions/0d435187cd55?raw)
