Files

1036 lines
28 KiB
JSON

{
"openapi": "3.0.0",
"info": {
"title": "ZeroTierOne Service API",
"version": "0.1.0",
"description": "<p> This API controls the ZeroTier service that runs in the background on your computer. This is how zerotier-cli, and the macOS and Windows apps control the service. </p> <p> API requests must be authenticated via an authentication token. ZeroTier One saves this token in the authtoken.secret file in its working directory. This token may be supplied via the X-ZT1-Auth HTTP request header. </p> <p> For example: <code>curl -H \"X-ZT1-Auth: $TOKEN\" http://localhost:9993/status</code> </p> <p> The token can be found in: <ul> <li>Mac :: ~/Library/Application Support/ZeroTier/authtoken.secret</li> <li>Windows :: \\ProgramData\\ZeroTier\\One</li> <li>Linux :: /var/lib/zerotier-one</li> </ul> </p> <p> You can get the OpenAPI spec here as well: <code>https://docs.zerotier.com/openapi/servicev1.json</code></p>",
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
}
},
"servers": [
{
"url": "http://localhost:9993",
"description": "Production Server"
}
],
"tags": [
{
"name": "status",
"description": "status"
},
{
"name": "network",
"description": "settings and status of a joined network"
},
{
"name": "peer",
"description": "peer status"
}
],
"paths": {
"/controller": {
"get": {
"tags": ["controller"],
"summary": "Get Controller Status.",
"operationId": "getControllerStatus",
"description": "Check for controller function and return controller status.",
"responses": {
"200": {
"description": "Status object.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ControllerStatus"
}
}
}
},
"401": {
"$ref": "#/components/responses/UnauthorizedError"
}
}
}
},
"/controller/network": {
"get": {
"tags": ["controller"],
"summary": "List Networks.",
"operationId": "getControllerNetworks",
"description": "List IDs of all networks hosted by this controller.",
"responses": {
"200": {
"description": "List of network IDs.",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "string",
"example": "3e245e31af7a726a"
}
}
}
}
},
"401": {
"$ref": "#/components/responses/UnauthorizedError"
}
}
}
},
"/controller/network/{networkID}": {
"get": {
"tags": ["controller"],
"summary": "Get Network by ID.",
"description": "Get details of a network by its ID.",
"operationId": "getControllerNetwork",
"parameters": [
{
"name": "networkID",
"description": "ID of the network.",
"in": "path",
"required": true,
"schema": {
"type": "string",
"example": "3e245e31af7a726a"
}
}
],
"responses": {
"200": {
"description": "Network Details.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ControllerNetwork"
}
}
}
},
"401": {
"$ref": "#/components/responses/UnauthorizedError"
}
}
},
"post": {
"tags": ["controller"],
"summary": "Create or Update a Network.",
"operationId": "setControllerNetwork",
"parameters": [
{
"name": "networkID",
"description": "ID of the network.",
"in": "path",
"required": true,
"schema": {
"type": "string",
"example": "3e245e31af7a726a"
}
}
],
"requestBody": {
"description": "Network object JSON.",
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ControllerNetwork"
}
}
}
},
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ControllerNetwork"
}
}
}
},
"401": {
"$ref": "#/components/responses/UnauthorizedError"
}
}
}
},
"/controller/network/{controllerID}": {
"post": {
"tags": ["controller"],
"summary": "Generate Random Network ID.",
"operationId": "generateControllerNetwork",
"description": "Create a new network with a random ID.",
"parameters": [
{
"name": "controllerID",
"description": "Node ID of the controller.",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"description": "Network object JSON.",
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ControllerNetwork"
}
}
}
},
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ControllerNetwork"
}
}
}
},
"401": {
"$ref": "#/components/responses/UnauthorizedError"
}
}
}
},
"/controller/network/{networkID}/member": {
"get": {
"tags": ["controller"],
"summary": "List Network Members.",
"operationId": "getControllerNetworkMembers",
"description": "JSON object containing all member IDs as keys and their memberRevisionCounter values as values.",
"parameters": [
{
"name": "networkID",
"description": "ID of the network.",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "object",
"additionalProperties": {
"type": "integer"
},
"example": { "03d516a9df": 5, "b9d5ad8e13": 1 }
}
}
}
},
"401": {
"$ref": "#/components/responses/UnauthorizedError"
}
}
}
},
"/controller/network/{networkID}/member/{nodeID}": {
"get": {
"tags": ["controller"],
"summary": "Get Network Member Details by ID.",
"operationId": "getControllerNetworkMember",
"parameters": [
{
"name": "networkID",
"description": "ID of the network.",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "nodeID",
"description": "ID of the member node.",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ControllerNetworkMember"
}
}
}
},
"401": {
"$ref": "#/components/responses/UnauthorizedError"
}
}
}
},
"/status": {
"get": {
"tags": ["status"],
"summary": "Node status and addressing info.",
"operationId": "getStatus",
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Status"
}
}
}
},
"401": {
"$ref": "#/components/responses/UnauthorizedError"
}
}
}
},
"/network": {
"get": {
"tags": ["network"],
"summary": "Get all network memberships.",
"operationId": "getNetworks",
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Network"
}
}
}
}
},
"401": {
"$ref": "#/components/responses/UnauthorizedError"
}
}
}
},
"/network/{networkID}": {
"get": {
"tags": ["network"],
"summary": "Get a joined Network membership configuration by Network ID.",
"operationId": "getNetwork",
"parameters": [
{
"name": "networkID",
"description": "ID of the network to get.",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Network"
}
}
}
},
"401": {
"$ref": "#/components/responses/UnauthorizedError"
}
}
},
"post": {
"tags": ["network"],
"summary": "Join a network or update its configuration by Network ID.",
"operationId": "updateNetwork",
"parameters": [
{
"name": "networkID",
"description": "ID of the network to change.",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"description": "Network membership object",
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Network"
}
}
}
},
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Network"
}
}
}
},
"401": {
"$ref": "#/components/responses/UnauthorizedError"
}
}
},
"delete": {
"tags": ["network"],
"summary": "Leave a network.",
"operationId": "deleteNetwork",
"parameters": [
{
"name": "networkID",
"description": "ID of the network",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Network deleted."
},
"401": {
"$ref": "#/components/responses/UnauthorizedError"
}
}
}
},
"/peer": {
"get": {
"tags": ["peer"],
"summary": "Get all peers.",
"operationId": "getPeers",
"responses": {
"200": {
"description": "Array of Peer objects",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Peer"
}
}
}
}
},
"401": {
"$ref": "#/components/responses/UnauthorizedError"
}
}
}
},
"/peer/{address}": {
"get": {
"tags": ["peer"],
"summary": "Get information about a specific peer by Node ID.",
"operationId": "getPeer",
"parameters": [
{
"name": "address",
"description": "ZeroTier address of the peer to get",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Peer object",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Peer"
}
}
}
},
"401": {
"$ref": "#/components/responses/UnauthorizedError"
}
}
}
}
},
"components": {
"securitySchemes": {
"ApiKeyAuth": {
"type": "apiKey",
"in": "header",
"name": "X-ZT1-Auth"
}
},
"responses": {
"UnauthorizedError": {
"description": "Authorization required."
}
},
"schemas": {
"ControllerStatus": {
"type": "object",
"properties": {
"controller": {
"type": "boolean",
"readOnly": true
},
"apiVersion": {
"type": "integer",
"example": 3,
"readOnly": true
},
"clock": {
"type": "integer",
"format": "int64",
"example": 1623101592,
"readOnly": true
}
}
},
"ControllerNetwork": {
"type": "object",
"properties": {
"id": {
"type": "string",
"readOnly": true,
"example": "3e245e31af000001"
},
"nwid": {
"type": "string",
"readOnly": true,
"example": "3e245e31af000001"
},
"objtype": {
"type": "string",
"example": "network",
"readOnly": true
},
"name": {
"type": "string",
"example": "my-cool-network"
},
"creationTime": {
"type": "number",
"example": 1623101592,
"readOnly": true
},
"private": {
"type": "boolean"
},
"enableBroadcast": {
"type": "boolean"
},
"v4AssignMode": {
"type": "object",
"properties": {
"zt": {
"type": "boolean"
}
}
},
"v6AssignMode": {
"type": "object",
"properties": {
"6plane": {
"type": "boolean"
},
"rfc4193": {
"type": "boolean"
},
"zt": {
"type": "boolean"
}
}
},
"mtu": {
"type": "integer",
"example": 2800
},
"multicastLimit": {
"type": "integer",
"example": 32
},
"revision": {
"type": "integer",
"example": 1,
"readOnly": true
},
"routes": {
"type": "array",
"items": {
"type": "object",
"properties": {
"target": {
"type": "string",
"example": "192.168.192.0/24"
},
"via": {
"type": "string",
"example": "192.168.192.1",
"nullable": true
}
}
}
},
"ipAssignmentPools": {
"type": "array",
"items": {
"type": "object",
"properties": {
"ipRangeStart": {
"type": "string",
"example": "192.168.192.1"
},
"ipRangeEnd": {
"type": "string",
"example": "192.168.192.254"
}
}
}
},
"rules": {
"type": "array",
"items": {
"type": "object"
}
},
"capabilities": {
"type": "array",
"items": {
"type": "object"
}
},
"tags": {
"type": "array",
"items": {
"type": "object"
}
},
"remoteTraceTarget": {
"type": "string",
"example": "7f5d90eb87"
},
"remoteTraceLevel": {
"type": "integer"
}
}
},
"ControllerNetworkMember": {
"type": "object",
"properties": {
"id": {
"type": "string",
"readOnly": true,
"example": "eb8d45c5c9"
},
"address": {
"type": "string",
"readOnly": true,
"example": "eb8d45c5c9"
},
"nwid": {
"type": "string",
"readOnly": true,
"example": "3e245e31af000001"
},
"authorized": {
"type": "boolean"
},
"activeBridge": {
"type": "boolean"
},
"identity": {
"type": "string",
"readOnly": true,
"example": "eb8d45c5c9:0:0279558f1a731cb2f628b3adc9f8915d7c2f3752e07d75f2d75fde08274b9c3a43d8b04115fd30f37043f61758ac874b844cc184fdf51e1022e988c1d093a50d:91a840bcd3fbac910afc56be4222973f675204a0ca9625218352e1c82debaa758b915d948c5fe4bd3c38cf1255904804a5b937f5edaef182ba8d5f3d8a243329"
},
"ipAssignments": {
"type": "array",
"items": {
"type": "string",
"example": "10.147.20.190"
}
},
"revision": {
"type": "integer",
"readOnly": true,
"example": 1
},
"vMajor": {
"type": "integer",
"readOnly": true,
"example": 1
},
"vMinor": {
"type": "integer",
"readOnly": true,
"example": 6
},
"vRev": {
"type": "integer",
"readOnly": true,
"example": 5
},
"vProto": {
"type": "integer",
"readOnly": true,
"example": 5
}
}
},
"Status": {
"type": "object",
"properties": {
"address": {
"type": "string",
"example": "0deadbeef1"
},
"clock": {
"type": "integer",
"format": "int64",
"example": 1618948931097
},
"config": {
"type": "object",
"properties": {
"settings": {
"type": "object",
"properties": {
"allowTcpFallbackRelay": {
"type": "boolean"
},
"portMappingEnabled": {
"type": "boolean"
},
"primaryPort": {
"type": "integer",
"example": 9993
}
}
}
}
},
"online": {
"type": "boolean"
},
"planetWorldId": {
"type": "integer",
"format": "int64",
"example": 149604618
},
"planetWorldTimestamp": {
"type": "integer",
"format": "int64",
"example": 1618339625163
},
"publicIdentity": {
"type": "string",
"example": "33c799cb58:0:690b44091ec50a44eb7f7769354b49abb47ac8747d99d547a1ec8c4d47623c5a6e3927f29b8d8443aebebc9ba4d4a812bd8902d71318db34b89d00186e8f4e4e"
},
"tcpFallbackActive": {
"type": "boolean"
},
"version": {
"type": "string",
"example": "1.6.4"
},
"versionBuild": {
"type": "integer",
"example": 0
},
"versionMajor": {
"type": "integer",
"example": 1
},
"versionMinor": {
"type": "integer",
"example": 6
},
"versionRev": {
"type": "integer",
"example": 4
}
}
},
"Network": {
"allOf": [
{
"type": "object",
"properties": {
"allowDNS": {
"type": "boolean",
"readOnly": false,
"description": "Let ZeroTier modify the system's DNS settings.",
"example": false
},
"allowDefault": {
"type": "boolean",
"readOnly": false,
"description": "Let ZeroTier modify the system's default route.",
"example": false
},
"allowGlobal": {
"type": "boolean",
"readOnly": false,
"description": "Let ZeroTier manage IP addresses and route assignments that aren't in private ranges (rfc1918).",
"example": false
},
"allowManaged": {
"type": "boolean",
"readOnly": false,
"description": "Let ZeroTier manage IP addresses and Route assignments.",
"example": true
}
}
},
{
"type": "object",
"properties": {
"allowDNS": {
"type": "boolean",
"readOnly": false,
"description": "Let ZeroTier modify the system's DNS settings."
},
"allowDefault": {
"type": "boolean",
"readOnly": false,
"description": "Let ZeroTier modify the system's default route."
},
"allowGlobal": {
"type": "boolean",
"readOnly": false,
"description": "Let ZeroTier manage IP addresses and Route assignments that aren't in private ranges (rfc1918)."
},
"allowManaged": {
"type": "boolean",
"readOnly": false,
"description": "Let ZeroTier to manage IP addresses and Route assignments."
},
"assignedAddresses": {
"type": "array",
"items": {
"type": "string",
"example": "10.147.20.190"
}
},
"bridge": {
"type": "boolean"
},
"broadcastEnabled": {
"type": "boolean"
},
"dns": {
"type": "object",
"properties": {
"domain": {
"type": "string",
"example": "zt.example.com"
},
"servers": {
"type": "array",
"items": {
"type": "string",
"example": "10.147.20.3"
}
}
}
},
"id": {
"type": "string",
"example": "565799d8f620c5c5"
},
"mac": {
"type": "string",
"example": "e6:d2:2b:e6:68:73",
"description": "MAC address for this network's interface."
},
"mtu": {
"type": "integer",
"example": 2800
},
"multicastSubscriptions": {
"type": "array",
"items": {
"type": "object",
"properties": {
"adi": {
"type": "integer",
"format": "int64",
"example": 0
},
"mac": {
"type": "string",
"example": "34:34:ff:da:6e:ff"
}
}
}
},
"name": {
"type": "string",
"example": "clever_krum"
},
"netconfRevision": {
"type": "integer",
"example": 123
},
"portDeviceName": {
"type": "string",
"example": "ztnnhrtimp"
},
"portError": {
"type": "integer",
"example": 0
},
"routes": {
"type": "array",
"items": {
"properties": {
"flags": {
"type": "integer",
"example": 0
},
"metric": {
"type": "integer",
"example": 0
},
"target": {
"type": "string",
"example": "10.147.20.0/24"
},
"via": {
"type": "string",
"example": "192.168.168.5"
}
}
}
},
"status": {
"type": "string",
"example": "OK"
},
"type": {
"type": "string",
"example": "PRIVATE"
}
}
}
]
},
"Peer": {
"type": "object",
"properties": {
"address": {
"type": "string",
"example": "992fcf1db7"
},
"isBonded": {
"type": "boolean",
"example": false
},
"latency": {
"type": "integer",
"example": 40
},
"paths": {
"type": "array",
"items": {
"type": "object",
"properties": {
"active": {
"type": "boolean"
},
"address": {
"type": "string",
"example": "195.181.173.159/9993"
},
"expired": {
"type": "boolean",
"example": false
},
"lastReceive": {
"type": "integer",
"format": "int64",
"example": 1618955164580
},
"lastSend": {
"type": "integer",
"format": "int64",
"example": 1618955164596
},
"preferred": {
"type": "boolean",
"example": true
},
"trustedPathId": {
"type": "integer",
"example": 0
}
}
}
},
"role": {
"type": "string",
"example": "LEAF"
},
"version": {
"type": "string",
"example": "1.6.4"
},
"versionMajor": {
"type": "integer",
"example": 1
},
"versionMinor": {
"type": "integer",
"example": 6
},
"versionRev": {
"type": "integer",
"example": 4
}
}
}
}
},
"security": [
{
"ApiKeyAuth": []
}
]
}