Reference
Management API reference
Authentication, tunnel operations, and common management endpoints.
The management API is served at https://manage.femtoport.com. Versioned management paths begin with /api/v1/. The service also exposes its OpenAPI document for endpoint and schema details.
Authentication
Authenticated routes accept a browser session cookie or an Authorization: Bearer <key> header. A management API key belongs to one workspace and carries the role of the browser session that created it. Create one from a browser session using POST /api/v1/api-keys with a JSON label; the response includes api_key. Machine keys cannot create other machine keys. Store the key securely. List your active sessions and keys with GET /api/v1/sessions and revoke one with DELETE /api/v1/sessions/{token_id}.
An agent token (kpt_…) connects an agent to a tunnel; it is a different credential from a management API key. Most customer routes require acceptance of the current legal terms. When acceptance is needed the API returns HTTP 428 with {"error":"legal_acceptance_required"}. Invalid or revoked credentials return HTTP 401; insufficient role returns HTTP 403. Errors are generally plain text, so clients should not assume all responses are JSON.
Tunnels
| Method and path | Purpose |
|---|---|
GET /api/v1/tunnels | List tunnels in the current workspace. |
POST /api/v1/tunnels | Create a tunnel and initial agent token. |
GET /api/v1/tunnels/{id} | Read one tunnel. |
PATCH /api/v1/tunnels/{id} | Update tunnel configuration. |
POST /api/v1/tunnels/{id}/enabled | Enable or disable with {"enabled":true} or {"enabled":false}. |
DELETE /api/v1/tunnels/{id} | Delete a tunnel; owner or admin role required. |
GET /api/v1/tunnels/{id}/agents | List connected agents. |
GET /api/v1/tunnels/{id}/tokens | List agent token metadata. |
POST /api/v1/tunnels/{id}/tokens | Issue another agent token; optional JSON label. |
DELETE /api/v1/tunnels/{id}/tokens/{token_id} | Revoke an agent token; owner or admin role required. |
Create, update, toggle and issue-token operations require owner, admin, or member role. A create request needs target and may specify backend_mode; it defaults to proxy. For a proxy, the target is an HTTP or HTTPS URL or host:port. Other modes are static and files (absolute folder path), ssh (host and port), and vnc (desktop or host and port). Mode-specific configuration and validation apply. A successful create returns HTTP 201, including tunnel_id, public_url, token_id, and agent_token. Save the returned agent token securely. For tunnel updates, send the intended target and backend configuration; PATCH is not a generic partial merge of every field.
For example, using a management key held in an environment variable:
curl --fail-with-body https://manage.femtoport.com/api/v1/tunnels \
-H "Authorization: Bearer $FEMTOPORT_API_KEY" \
-H 'Content-Type: application/json' \
--data '{"target":"http://127.0.0.1:8080","backend_mode":"proxy"}'
The response contains a secret agent token. Avoid printing or recording it in shared logs. Issuing a replacement token does not automatically revoke the old one; revoke it when no longer needed. Token reveal has a separate verification flow.
Other resources
/api/v1/custom-domains lists and creates custom domains; the item routes support reading, updating, verification, certificate retry, and deletion. /api/v1/workspaces lists or creates workspaces, and /api/v1/workspaces/switch switches a browser session. /api/v1/me describes the authenticated context. The OpenAPI document lists request bodies and the remaining endpoints. Access to individual actions depends on the caller's role and, for some account operations, a browser session.