const url = 'https://api.defined.net/v1/join-keys/dnjoin-P3RCTXN5LVFGBMJNYF2QHKWDOA';const options = { method: 'PATCH', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"expiresAt":"2027-06-01T00:00:00Z"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://api.defined.net/v1/join-keys/dnjoin-P3RCTXN5LVFGBMJNYF2QHKWDOA \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "expiresAt": "2027-06-01T00:00:00Z" }'Change a join key’s name or expiration. Its network, role, tags, and address prefixes can’t be changed; create a new key instead. Omitted properties keep their current values.
Token scope required: join-keys:update
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Example
dnjoin-P3RCTXN5LVFGBMJNYF2QHKWDOARequest Bodyrequired
Section titled “Request Bodyrequired”Only a join key’s name and expiration can be changed. Omitted properties keep their current
values, and other properties, such as networkID, are ignored.
object
Must be a DNS label: lowercase letters, digits, and hyphens, not starting or ending with a
hyphen. Must be unique within the organization. Can’t be null.
When the key stops enrolling hosts. Must be in the future. null removes the expiration.
Example
{ "expiresAt": "2027-06-01T00:00:00Z"}Responses
Section titled “Responses”Successful operation
object
object
Identifies the key. Hosts that enroll without reporting a usable hostname are named after it, followed by a random suffix.
Network that hosts enrolled with this key join.
Role assigned to hosts enrolled with this key.
Tags assigned to hosts enrolled with this key.
Prefixes from which hosts enrolled with this key are assigned addresses. Includes the network’s IPv6 prefix whenever the network has one.
Whether hosts enrolled with this key are ephemeral: deleted automatically once they stop checking in. Blocked hosts are never deleted this way.
When the key stops enrolling hosts. null means the key does not expire.
Example
{ "data": { "id": "dnjoin-P3RCTXN5LVFGBMJNYF2QHKWDOA", "organizationID": "org-F63A24JGCLJV3ZEUTLCBISGETA", "name": "ci-runner", "networkID": "network-KAOWMXZHZWCVMGGFKM22XEGYLE", "roleID": "role-PZEDBXHCEXKAKJPZ6XOQTIAJA4", "tags": [ "env:ci" ], "autoAssignCIDRs": [ "100.100.0.0/22", "fdef:c0:c0:1::/80" ], "expiresAt": "2027-06-01T00:00:00Z", "createdAt": "2026-10-29T15:00:00Z", "modifiedAt": "2026-10-30T09:00:00Z" }}Validation error
object
object
A static name for the error type
A short human readable description of the error
Describes the variable missing or malformed
The query parameter the error relates to, such as filter.targetType
Machine-readable details about the error. ERR_LIMIT_EXCEEDED errors carry limit and limitName.
object
The maximum number of resources allowed
The kind of resource the limit applies to
Examples
A join key already exists with the name.
{ "errors": [ { "code": "ERR_DUPLICATE_VALUE", "message": "value already exists", "path": "name" } ]}The name is not a DNS label.
{ "errors": [ { "code": "ERR_INVALID_VALUE", "message": "must contain only lowercase letters, digits, and hyphens, and must not start or end with a hyphen", "path": "name" } ]}`expiresAt` is not in the future.
{ "errors": [ { "code": "ERR_INVALID_VALUE", "message": "must be in the future", "path": "expiresAt" } ]}The network or role does not exist. Not returned on update.
{ "errors": [ { "code": "ERR_INVALID_REFERENCE", "message": "referenced value is invalid (perhaps it does not exist?)", "path": "networkID" } ]}An `autoAssignCIDRs` entry is an address rather than a CIDR prefix. Not returned on update.
{ "errors": [ { "code": "ERR_INVALID_VALUE", "message": "must be a CIDR prefix, not an address", "path": "autoAssignCIDRs[0]" } ]}An `autoAssignCIDRs` entry isn't exactly the network's IPv4 CIDR or IPv6 prefix. Not returned on update.
{ "errors": [ { "code": "ERR_OUT_OF_RANGE", "message": "CIDR prefix does not match the network's IPv4 CIDR", "path": "autoAssignCIDRs[0]" } ]}The API key is missing, invalid or expired.
object
object
A static name for the error type
A short human readable description of the error
Describes the variable missing or malformed
The query parameter the error relates to, such as filter.targetType
Machine-readable details about the error. ERR_LIMIT_EXCEEDED errors carry limit and limitName.
object
The maximum number of resources allowed
The kind of resource the limit applies to
Example
{ "errors": [ { "code": "ERR_UNAUTHORIZED", "message": "unauthorized" } ]}The API key lacks a required scope.
object
object
A static name for the error type
A short human readable description of the error
Describes the variable missing or malformed
The query parameter the error relates to, such as filter.targetType
Machine-readable details about the error. ERR_LIMIT_EXCEEDED errors carry limit and limitName.
object
The maximum number of resources allowed
The kind of resource the limit applies to
Examples
The API key lacks a required scope.
{ "errors": [ { "code": "ERR_FORBIDDEN", "message": "api key must support the following scopes: hosts:read" } ]}Join key not found
object
object
A static name for the error type
A short human readable description of the error
Describes the variable missing or malformed
The query parameter the error relates to, such as filter.targetType
Machine-readable details about the error. ERR_LIMIT_EXCEEDED errors carry limit and limitName.
object
The maximum number of resources allowed
The kind of resource the limit applies to
Example
{ "errors": [ { "code": "ERR_NOT_FOUND", "message": "resource not found" } ]}The organization has exceeded its API request rate limit. Retry the request after a short delay.
object
object
A static name for the error type
A short human readable description of the error
Describes the variable missing or malformed
The query parameter the error relates to, such as filter.targetType
Machine-readable details about the error. ERR_LIMIT_EXCEEDED errors carry limit and limitName.
object
The maximum number of resources allowed
The kind of resource the limit applies to
Example
{ "errors": [ { "code": "ERR_TOO_MANY_REQUESTS", "message": "too many requests" } ]}