> For the complete documentation index, see [llms.txt](https://learn.netmaker.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://learn.netmaker.io/api-spec/enrollmentkeys.md).

# EnrollmentKeys

## GET /api/v1/enrollment-keys

> Lists all EnrollmentKeys for admins

```json
{"openapi":"3.1.1","info":{"title":"NetMaker","version":"1.4.0"},"tags":[],"servers":[{"url":"http://api.demo.netmaker.io"}],"security":[{"oauth":[]}],"paths":{"/api/v1/enrollment-keys":{"get":{"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/models.EnrollmentKey"},"type":"array"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/models.ErrorResponse"}}}}},"summary":"Lists all EnrollmentKeys for admins","tags":["EnrollmentKeys"]}}},"components":{"schemas":{"models.EnrollmentKey":{"properties":{"auto_assign_gw":{"type":"boolean"},"auto_egress":{"type":"boolean"},"default":{"type":"boolean"},"expiration":{"type":"string"},"groups":{"items":{"type":"string"},"type":"array"},"networks":{"items":{"type":"string"},"type":"array"},"relay":{"type":"string"},"tags":{"items":{"type":"string"},"type":"array"},"token":{"description":"B64 value of EnrollmentToken","type":"string"},"type":{"$ref":"#/components/schemas/models.KeyType"},"unlimited":{"type":"boolean"},"uses_remaining":{"type":"integer"},"value":{"type":"string"}},"type":"object"},"models.KeyType":{"enum":[0,1,2,3],"type":"integer"},"models.ErrorResponse":{"properties":{"code":{"type":"integer"},"message":{"type":"string"},"response":{}},"type":"object"}}}}
```

## POST /api/v1/enrollment-keys

> Creates an EnrollmentKey for hosts to register with server and join networks

```json
{"openapi":"3.1.1","info":{"title":"NetMaker","version":"1.4.0"},"tags":[],"servers":[{"url":"http://api.demo.netmaker.io"}],"security":[{"oauth":[]}],"paths":{"/api/v1/enrollment-keys":{"post":{"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/models.EnrollmentKey"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/models.ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/models.ErrorResponse"}}}}},"summary":"Creates an EnrollmentKey for hosts to register with server and join networks","tags":["EnrollmentKeys"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/models.APIEnrollmentKey"}}},"description":"Enrollment Key parameters","required":true}}}},"components":{"schemas":{"models.EnrollmentKey":{"properties":{"auto_assign_gw":{"type":"boolean"},"auto_egress":{"type":"boolean"},"default":{"type":"boolean"},"expiration":{"type":"string"},"groups":{"items":{"type":"string"},"type":"array"},"networks":{"items":{"type":"string"},"type":"array"},"relay":{"type":"string"},"tags":{"items":{"type":"string"},"type":"array"},"token":{"description":"B64 value of EnrollmentToken","type":"string"},"type":{"$ref":"#/components/schemas/models.KeyType"},"unlimited":{"type":"boolean"},"uses_remaining":{"type":"integer"},"value":{"type":"string"}},"type":"object"},"models.KeyType":{"enum":[0,1,2,3],"type":"integer"},"models.ErrorResponse":{"properties":{"code":{"type":"integer"},"message":{"type":"string"},"response":{}},"type":"object"},"models.APIEnrollmentKey":{"properties":{"auto_assign_gw":{"type":"boolean"},"auto_egress":{"type":"boolean"},"expiration":{"format":"int64","type":"integer"},"groups":{"items":{"type":"string"},"type":"array"},"networks":{"items":{"type":"string"},"type":"array"},"relay":{"type":"string"},"tags":{"items":{"type":"string"},"type":"array"},"type":{"$ref":"#/components/schemas/models.KeyType"},"unlimited":{"type":"boolean"},"uses_remaining":{"type":"integer"}},"required":["tags"],"type":"object"}}}}
```

## PUT /api/v1/enrollment-keys/{keyID}

> Updates an EnrollmentKey

```json
{"openapi":"3.1.1","info":{"title":"NetMaker","version":"1.4.0"},"tags":[],"servers":[{"url":"http://api.demo.netmaker.io"}],"security":[{"oauth":[]}],"paths":{"/api/v1/enrollment-keys/{keyID}":{"put":{"parameters":[{"schema":{"type":"string"},"description":"Enrollment Key ID","in":"path","name":"keyID","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/models.EnrollmentKey"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/models.ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/models.ErrorResponse"}}}}},"summary":"Updates an EnrollmentKey","tags":["EnrollmentKeys"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/models.APIEnrollmentKey"}}},"description":"Enrollment Key parameters","required":true}}}},"components":{"schemas":{"models.EnrollmentKey":{"properties":{"auto_assign_gw":{"type":"boolean"},"auto_egress":{"type":"boolean"},"default":{"type":"boolean"},"expiration":{"type":"string"},"groups":{"items":{"type":"string"},"type":"array"},"networks":{"items":{"type":"string"},"type":"array"},"relay":{"type":"string"},"tags":{"items":{"type":"string"},"type":"array"},"token":{"description":"B64 value of EnrollmentToken","type":"string"},"type":{"$ref":"#/components/schemas/models.KeyType"},"unlimited":{"type":"boolean"},"uses_remaining":{"type":"integer"},"value":{"type":"string"}},"type":"object"},"models.KeyType":{"enum":[0,1,2,3],"type":"integer"},"models.ErrorResponse":{"properties":{"code":{"type":"integer"},"message":{"type":"string"},"response":{}},"type":"object"},"models.APIEnrollmentKey":{"properties":{"auto_assign_gw":{"type":"boolean"},"auto_egress":{"type":"boolean"},"expiration":{"format":"int64","type":"integer"},"groups":{"items":{"type":"string"},"type":"array"},"networks":{"items":{"type":"string"},"type":"array"},"relay":{"type":"string"},"tags":{"items":{"type":"string"},"type":"array"},"type":{"$ref":"#/components/schemas/models.KeyType"},"unlimited":{"type":"boolean"},"uses_remaining":{"type":"integer"}},"required":["tags"],"type":"object"}}}}
```

## DELETE /api/v1/enrollment-keys/{keyID}

> Deletes an EnrollmentKey from Netmaker server

```json
{"openapi":"3.1.1","info":{"title":"NetMaker","version":"1.4.0"},"tags":[],"servers":[{"url":"http://api.demo.netmaker.io"}],"security":[{"oauth":[]}],"paths":{"/api/v1/enrollment-keys/{keyID}":{"delete":{"parameters":[{"schema":{"type":"string"},"description":"Enrollment Key ID","in":"path","name":"keyID","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"string"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/models.ErrorResponse"}}}}},"summary":"Deletes an EnrollmentKey from Netmaker server","tags":["EnrollmentKeys"]}}},"components":{"schemas":{"models.ErrorResponse":{"properties":{"code":{"type":"integer"},"message":{"type":"string"},"response":{}},"type":"object"}}}}
```

## POST /api/v1/host/register/{token}

> Handles a Netclient registration with server and add nodes accordingly

```json
{"openapi":"3.1.1","info":{"title":"NetMaker","version":"1.4.0"},"tags":[],"servers":[{"url":"http://api.demo.netmaker.io"}],"paths":{"/api/v1/host/register/{token}":{"post":{"parameters":[{"schema":{"type":"string"},"description":"Enrollment Key Token","in":"path","name":"token","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/models.RegisterResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/models.ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/models.ErrorResponse"}}}}},"summary":"Handles a Netclient registration with server and add nodes accordingly","tags":["EnrollmentKeys"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/models.Host"}}},"description":"Host registration parameters","required":true}}}},"components":{"schemas":{"models.RegisterResponse":{"properties":{"requested_host":{"$ref":"#/components/schemas/models.Host"},"server_config":{"$ref":"#/components/schemas/models.ServerConfig"}},"type":"object"},"models.Host":{"properties":{"autoupdate":{"type":"boolean"},"country_code":{"type":"string"},"daemoninstalled":{"type":"boolean"},"debug":{"type":"boolean"},"defaultinterface":{"type":"string"},"dns_status":{"type":"string"},"enable_flow_logs":{"type":"boolean"},"endpointip":{"items":{"type":"integer"},"type":"array"},"endpointipv6":{"items":{"type":"integer"},"type":"array"},"firewallinuse":{"type":"string"},"hostpass":{"type":"string"},"id":{"type":"string"},"interface":{"type":"string"},"interfaces":{"items":{"$ref":"#/components/schemas/models.Iface"},"type":"array"},"ipforwarding":{"type":"boolean"},"isdefault":{"type":"boolean"},"isdocker":{"type":"boolean"},"isk8s":{"type":"boolean"},"isstatic":{"type":"boolean"},"isstaticport":{"type":"boolean"},"kernel_version":{"type":"string"},"listenport":{"type":"integer"},"location":{"description":"Format: \"lat,lon\"","type":"string"},"macaddress":{"items":{"type":"integer"},"type":"array"},"mtu":{"type":"integer"},"name":{"type":"string"},"nat_type":{"type":"string"},"nodes":{"items":{"type":"string"},"type":"array"},"os":{"type":"string"},"os_family":{"type":"string"},"os_version":{"type":"string"},"persistentkeepalive":{"format":"int64","type":"integer"},"publickey":{"items":{"type":"integer"},"type":"array"},"traffickeypublic":{"items":{"type":"integer"},"type":"array"},"turn_endpoint":{"$ref":"#/components/schemas/netip.AddrPort"},"verbosity":{"type":"integer"},"version":{"type":"string"},"wg_public_listen_port":{"type":"integer"}},"type":"object"},"models.Iface":{"properties":{"address":{"$ref":"#/components/schemas/net.IPNet"},"addressString":{"type":"string"},"name":{"type":"string"}},"type":"object"},"net.IPNet":{"properties":{"ip":{"description":"network number","items":{"type":"integer"},"type":"array"},"mask":{"description":"network mask","items":{"format":"int32","type":"integer"},"type":"array"}},"type":"object"},"netip.AddrPort":{"type":"object"},"models.ServerConfig":{"properties":{"Is_EE":{"type":"boolean"},"api":{"type":"string"},"apihost":{"type":"string"},"apiport":{"type":"string"},"broker":{"type":"string"},"brokerType":{"type":"string"},"coreDNSAddr":{"type":"string"},"defaultDomain":{"type":"string"},"dnsmode":{"type":"string"},"endpointDetection":{"type":"boolean"},"grpc":{"type":"string"},"ipdetectionInterval":{"type":"integer"},"manageDNS":{"type":"boolean"},"metricInterval":{"type":"string"},"metricsPort":{"type":"integer"},"mqpassword":{"type":"string"},"mqport":{"type":"string"},"mquserName":{"type":"string"},"peerConnectionCheckInterval":{"type":"string"},"server":{"type":"string"},"stun":{"type":"boolean"},"stunServers":{"type":"string"},"trafficKey":{"items":{"type":"integer"},"type":"array"},"version":{"type":"string"}},"type":"object"},"models.ErrorResponse":{"properties":{"code":{"type":"integer"},"message":{"type":"string"},"response":{}},"type":"object"}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://learn.netmaker.io/api-spec/enrollmentkeys.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
