|
|
1 an în urmă | |
|---|---|---|
| .. | ||
| device.md | 4f4f317174 api.md: direct TOC links to new publicapi docs location | 1 an în urmă |
| deviceinvites.md | c56e0c4934 publicapi: include device and user invites API documentation (#12168) | 1 an în urmă |
| readme.md | 4f4f317174 api.md: direct TOC links to new publicapi docs location | 1 an în urmă |
| tailnet.md | 4f4f317174 api.md: direct TOC links to new publicapi docs location | 1 an în urmă |
| userinvites.md | c56e0c4934 publicapi: include device and user invites API documentation (#12168) | 1 an în urmă |
The Tailscale API is a (mostly) RESTful API. Typically, both POST bodies and responses are JSON-encoded.
The base URL for the Tailscale API is https://api.tailscale.com/api/v2/.
Examples in this document may abbreviate this to /api/v2/.
Requests to the Tailscale API are authenticated with an API access token (sometimes called an API key). Access tokens can be supplied as the username portion of HTTP Basic authentication (leave the password blank) or as an OAuth Bearer token:
# passing token with basic auth
curl -u "tskey-api-xxxxx:" https://api.tailscale.com/api/v2/...
# passing token as bearer token
curl -H "Authorization: Bearer tskey-api-xxxxx" https://api.tailscale.com/api/v2/...
Access tokens for individual users can be created and managed from the Keys page of the admin console.
These tokens will have the same permissions as the owning user, and can be set to expire in 1 to 90 days.
Access tokens are identifiable by the prefix tskey-api-.
Alternatively, an OAuth client can be used to create short-lived access tokens with scoped permission.
OAuth clients don't expire, and can therefore be used to provide ongoing access to the API, creating access tokens as needed.
OAuth clients and the access tokens they create are not tied to an individual Tailscale user.
OAuth client secrets are identifiable by the prefix tskey-client-.
Learn more about OAuth clients.
The Tailscale API returns status codes consistent with standard HTTP conventions. In addition to the status code, errors may include additional information in the response body:
{
"message": "additional error information"
}
The Tailscale API does not currently support pagination. All results are returned at once.
GET /api/v2/device/{deviceid}DELETE /api/v2/device/{deviceID}POST /api/v2/device/{deviceID}/expireGET /api/v2/device/{deviceID}/routesPOST /api/v2/device/{deviceID}/routesPOST /api/v2/device/{deviceID}/authorizedPOST /api/v2/device/{deviceID}/tagsPOST /api/v2/device/{deviceID}/keyPOST /api/v2/device/{deviceID}/ipGET /api/v2/device/{deviceID}/attributesPOST /api/v2/device/{deviceID}/attributes/{attributeKey}DELETE /api/v2/device/{deviceID}/attributes/{attributeKey}GET /api/v2/device/{deviceID}/device-invitesPOST /api/v2/device/{deviceID}/device-invitesGET /api/v2/tailnet/{tailnet}/aclPOST /api/v2/tailnet/{tailnet}/aclPOST /api/v2/tailnet/{tailnet}/acl/previewPOST /api/v2/tailnet/{tailnet}/acl/validateGET /api/v2/tailnet/{tailnet}/devicesGET /api/v2/tailnet/{tailnet}/keysPOST /api/v2/tailnet/{tailnet}/keysGET /api/v2/tailnet/{tailnet}/keys/{keyid}DELETE /api/v2/tailnet/{tailnet}/keys/{keyid}GET /api/v2/tailnet/{tailnet}/dns/nameserversPOST /api/v2/tailnet/{tailnet}/dns/nameserversGET /api/v2/tailnet/{tailnet}/dns/preferencesPOST /api/v2/tailnet/{tailnet}/dns/preferencesGET /api/v2/tailnet/{tailnet}/dns/searchpathsPOST /api/v2/tailnet/{tailnet}/dns/searchpathsGET /api/v2/tailnet/{tailnet}/dns/split-dnsPATCH /api/v2/tailnet/{tailnet}/dns/split-dnsPUT /api/v2/tailnet/{tailnet}/dns/split-dnsGET /api/v2/tailnet/{tailnet}/user-invitesPOST /api/v2/tailnet/{tailnet}/user-invitesGET /api/v2/user-invites/{userInviteId}DELETE /api/v2/user-invites/{userInviteId}POST /api/v2/user-invites/{userInviteId}/resendGET /api/v2/device-invites/{deviceInviteId}DELETE /api/v2/device-invites/{deviceInviteId}POST /api/v2/device-invites/{deviceInviteId}/resendPOST /api/v2/device-invites/-/accept