Skip to content

Public soft launch: these docs are still being updated. The next full update is on 28 November at 8 PM UTC. Public soft launch. Docs update 28 Nov, 8 PM UTC.

Hoody.com

Lookup tables for authentication. Every field and status is in the Authentication API and the API tokens API.

A session is the JWT from signing in; an auth token is an hdy_... token. “Own” means the token holds that permission.

CallWhat it doesSessionAuth token
POST /api/v1/users/auth/loginLog in with username or email and passwordNone neededNone needed
POST /api/v1/users/auth/2fa/verifyComplete login when the account has 2FA enabledNone needed, uses temp_tokenNone needed
POST /api/v1/users/auth/refreshRefresh the access tokenThe refresh token, as bearer and in the bodyNo
GET /api/v1/users/auth/meGet the current user profileFull profileWithout resources.read_account: identity fields (id, username, alias, public_key, timestamps), plus auth_token, support_reply_email and support_reply_email_stored
POST /api/v1/users/auth/logoutRevoke all previously issued session JWTs for the token ownerRevokes themAccepted, revokes nothing
GET /api/v1/users/auth/sessionsList the places your account is signed inYes, on api.hoody.comNo (403)
DELETE /api/v1/users/auth/sessions/{id}End one sign-in sessionYes, on api.hoody.comNo (403)
POST /api/v1/users/auth/sessions/revoke-othersEnd every sign-in session except this oneYes, on api.hoody.comNo (403)
POST /api/v1/users/auth/identity-claimRe-issue an identity claim for one audienceYesNo (403)
GET /api/v1/users/me/security-historyList your sign-in and security-event historyYesOwn resources.read_account, else 403
POST /api/v1/auth/tokensCreate a long-lived tokenYes; with 2FA and the token gate on, add otp_codeOwn resources.create_tokens
GET /api/v1/auth/tokensList tokensYour tokens visible in the current realm scope; the list can be truncatedOwn resources.create_tokens; lists the tokens created under it
GET /api/v1/auth/tokens/{id}Get token detailsYesOwn resources.create_tokens, tokens created under it
PATCH /api/v1/auth/tokens/{id} (PUT behaves the same)Update token configurationYes; with 2FA and the token gate on, otp_code for rights, realms, IP whitelist, expiry or enabled stateOwn resources.create_tokens, tokens created under it
DELETE /api/v1/auth/tokens/{id}Revoke the tokenYesOwn resources.create_tokens, tokens created under it
POST /api/v1/auth/tokens/{id}/copy, /add-realm, /remove-realmCopy a token; add or remove a realmYes; with 2FA and the token gate on, add otp_codeOwn resources.create_tokens, tokens created under it
GET /api/v1/auth/tokens/templatesList permission templatesYesNo (403)
GET /api/v1/auth/tokens/meRead the calling tokenNoYes, on the base host too when limited to realms
GET /api/v1/computers/{id}/env and its set and deleteEnvironment variablesValues shownValues null without computers.features.env_values
Account money: wallet, transactions, invoicesYesNot from a token limited to realms (REALM_TOKEN_ACCOUNT_MONEY)
PUT or PATCH /api/v1/users/{id}Update your profileYesNo (403)

The sessions and identity-claim routes also refuse HTTP Basic credentials. A refused auth token on token management gets 403 with Auth tokens cannot manage auth tokens, or the resources.create_tokens message under Child tokens.

Session (JWT from login)Auth token (hdy_...)
Lifetime1 day (access), 7 days (refresh)Configurable: ISO 8601 date, today, tomorrow, or forever
Use caseUser sessionsAutomation, AI, scripts
RefreshYes, with the refresh tokenNo: create a new one when it expires
IP whitelistNoYes, optional
RevocationLogout, called with a JWT, revokes all previously issued session JWTs for that ownerDelete or disable
VisibilityManaged by the browserShown once, at creation
SecurityShort lifetime limits exposureLong lifetime. An optional IP whitelist limits where it works; without one, a leaked token works from any address

A session is short-lived, refreshable without logging in again, tied to one user account and not suited to automation. An auth token has per-token permissions and can be revoked at any time.

The login endpoint requires password and at least one of email or username. The CLI has both flags, --email and --username. A refresh token is single-use: each refresh returns a new one, and a spent refresh token sent again more than 30 seconds later ends that sign-in.

Terminal window
# CLI stores the token automatically after login
hoody projects list

When 2FA is enabled and verified, login answers 200 with a challenge rather than a session: no token and no refreshToken.

{
"statusCode": 200,
"message": "2FA verification required",
"data": {
"requires_2fa": true,
"temp_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"method": "totp"
}
}

A client written against the first shape reads undefined for data.token and looks like a broken login. The temp_token lasts five minutes and is single-use. Exchange it at POST /api/v1/users/auth/2fa/verify with a six-digit code from the authenticator app or a ten-character backup code; that call returns the same token and refreshToken pair:

Terminal window
curl -X POST "https://api.hoody.com/api/v1/users/auth/2fa/verify" \
-H "Content-Type: application/json" \
-d '{"temp_token": "TEMP_TOKEN", "code": "123456"}'

Setup and backup-code regeneration: Two-factor authentication.

The API also accepts HTTP Basic with your username and password, username:password. On an account with 2FA, add a code after another colon: username:password:123456, with a six-digit code from the authenticator app or a ten-character backup code. Without a code the request gets 401 INVALID_OTP_CODE.

Terminal window
curl -u "USERNAME:PASSWORD:123456" "https://api.hoody.com/api/v1/users/auth/me"

Most requests accept an authenticator code that was already used, while it is still current. A backup code works once. A write that creates a credential, or widens what one can do, uses up its code:

ResourceWrites that use up the code
Auth tokensCreating or copying a token, adding a realm to it, or changing its permissions, realm_ids, expires_at, is_enabled, ip_whitelist, allow_no_realm, vault_access or event_access
Bot URLs and Bot keysCreating or rotating a key; changing a key’s enabled to true, its ipv4_allow or its expires_at; repointing a Bot URL; changing a Bot URL’s enabled or cors or iframable to true, or its limits
ComputersCreating or copying a computer with an SSH public key; an update that installs an SSH key or changes realm_ids; requesting an authorization claim (POST /api/v1/computers/{id}/authorize)
Proxy permissions and settingsEvery write or removal of a computer’s or project’s proxy permissions, since a removal can open access; a settings, default or state change to default allow or inherit, or enable_proxy true or null
ProjectsGranting a project permission, raising a member’s permission level, or changing a project’s realm_ids
PoolsInviting a member, or making a member admin
Storage sharesCreating a share; changing one to mode readwrite or enabled true; any change to expires_at, shortening it included
Your accountChanging your password; disabling the token gate with PUT /api/v1/users/auth/2fa/token-gate and enabled: false

Writes not listed above, such as renaming a token, key or Bot URL, changing a description, revoking and deleting, do not consume the code. Some changes that narrow access still consume it, including changes to the token fields listed above. Proxy alias writes do not consume a code.

Reusing a code on such a write, including the code you used to sign in, returns 401 INVALID_OTP_CODE (“This 2FA code was already used. Wait for the next code and retry.”): send the next code. 409 CREDENTIALS_CHANGED means your password or 2FA changed while the request ran; send it again with your current credentials. The sessions and identity-claim routes refuse HTTP Basic.

Each sign-in starts a session: a browser login, hoody login in a terminal, a device-code sign-in, or a GitHub or Google sign-in.

ItemValue
List orderThe session making the request first
Each entryHow the sign-in was made, the kind of client, when it started, when its device last confirmed it, and the address and country it came from
Ended sessionsstate=ended lists those that ended in the last 180 days, with when and why
End this sessionUse current as the id
After it endsAn unexpired access token gets 401 SESSION_REVOKED; an expired one gets 401 TOKEN_EXPIRED. Refreshing with that session’s validly signed refresh token returns 401 SESSION_REVOKED, even if the refresh token has expired. Sign in again
Auth tokens it createdKeep working. auth_tokens_created.count counts every token created in that session, deleted ones included; auth_tokens_created.tokens shows only the newest 20 that still exist, and not the tokens those tokens created. Check your full token list when you revoke access
Who can see and end themOnly you, from one of your own sign-ins. Auth tokens are refused, so a token you hand to a script or an agent cannot read where you are signed in or sign you out
Active sign-insUp to 500. At the limit, a new sign-in ends the one renewed longest ago (apps renew a sign-in regularly while in use)
New sign-insAt most 300 per account in a rolling hour. For an account without a server, 20 in the past hour is checked before a sign-in spends its credential; sign-ins already in progress can take the hour slightly past 20. Past either, sign-in routes answer 429 SESSION_CREATE_RATE_LIMITED with a Retry-After header. If the sign-in budget check returns this 429, it leaves the credential for that step unused. Retry after Retry-After if it is still valid; if a later step asks you to sign in again, start a new sign-in

In the Hub, open Account in the sidebar and go to Sign-in sessions. Press End on a row to end that sign-in, or End all other sessions to keep only this one.

An ended session shows why it ended: you ended it, you ended all your other sign-ins, you signed out everywhere, a password or two-factor change, a change to your account, the limit of 500, or a sign-in that looked copied to another device.

FieldAcceptsNotes
aliasASCII letters, digits, spaces, _ and -, 1 to 254 characters, with at least one non-space characterWhitespace-only aliases return 400; slashes and parentheses are rejected (422 validation error)
permissionsA tree such as { "projects": { "read": true } }A path left out is false. Every path: permission paths
permission_templatefull_access, external_customer, dev_team, finance_team, read_onlyTakes precedence over permissions. For production, replace full_access with an explicit tree of the operations the automation needs
Neither of the twoOmitting both fields gives an account-created token full access; a child token inherits its parent’s permissions
computers.features.env_values"computers": { "features": { "env_values": true } }Without it, the env routes list every key with a null value and values_redacted: true. full_access and dev_team grant it. It controls only what those routes return: anyone who can run commands in the computer or read its files can still read the environment there. See value redaction
ip_whitelistIPv4 addresses and CIDR ranges, or ["*"]["*"] allows all. An empty array is rejected, because the array form needs at least one entry
expires_atSee the formats belowFrom a session, omit it and the token never expires; a token created by another token always expires
realm_ids, allow_no_realmRealm IDs; true or falseSee tokens limited to realms. Token realms do not count toward your realm limit
deny_reauthorizationtrueRemoves resources.create_tokens and resources.vault and forces vault_access to false, so the token cannot create more tokens. For a token created from a session, an omitted or later expiry is capped at the delegated lifetime limit, 90 days by default. Combining it with an explicit grant of either permission or vault_access: true returns 400
otp_codeAn authenticator or backup codeRequired from a session when the account has 2FA and the token gate is on (the default), or 400 OTP_REQUIRED

The regular account limit defaults to 1,000 unexpired auth tokens, including disabled ones. Creating a token at that limit returns 409 AUTH_TOKEN_LIMIT_REACHED: delete tokens you no longer use. An account without a server can create tokens only while it holds fewer than 20, expired and disabled ones included, and a token’s public_storage can grow to at most 4 KiB.

expires_at accepts several formats:

{
"expires_at": "2026-12-31T23:59:59Z"
}

A token with an IP whitelist for a CI/CD pipeline:

POST Create token with IP whitelist for CI/CD pipeline
https://api.hoody.com/api/v1/auth/tokens
const response = await fetch('https://api.hoody.com/api/v1/auth/tokens', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_TOKEN'
  },
  body: `{
    "alias": "CI-CD Pipeline",
    "ip_whitelist": [
      "203.0.113.50/32",
      "198.51.100.0/24"
    ],
    "permission_template": "full_access",
    "expires_at": "2027-07-11T00:00:00Z"
  }`
});

const data = await response.json();
console.log(data);
curl --globoff -X POST 'https://api.hoody.com/api/v1/auth/tokens' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -d '{
  "alias": "CI-CD Pipeline",
  "ip_whitelist": [
    "203.0.113.50/32",
    "198.51.100.0/24"
  ],
  "permission_template": "full_access",
  "expires_at": "2027-07-11T00:00:00Z"
}'
$headers = @{
  'Content-Type' = 'application/json'
  'Authorization' = 'Bearer YOUR_TOKEN'
}

$body = @'
{
  "alias": "CI-CD Pipeline",
  "ip_whitelist": [
    "203.0.113.50/32",
    "198.51.100.0/24"
  ],
  "permission_template": "full_access",
  "expires_at": "2027-07-11T00:00:00Z"
}
'@

$response = Invoke-RestMethod -Uri 'https://api.hoody.com/api/v1/auth/tokens' `
  -Method POST `
  -Headers $headers `
  -Body $body

$response | ConvertTo-Json -Depth 100

The token itself is a long random string. An IP whitelist adds defense in depth: use it for production tokens, and skip it for low-sensitivity automation.

PATCH /api/v1/auth/tokens/{id} changes the IP whitelist, expiry, permissions or enabled state. From a session on a 2FA account with the token gate enabled, add otp_code.

PATCH Update token IP whitelist
https://api.hoody.com/api/v1/auth/tokens/{id}
const response = await fetch('https://api.hoody.com/api/v1/auth/tokens/{id}', {
  method: 'PATCH',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_TOKEN'
  },
  body: `{
    "ip_whitelist": [
      "203.0.113.10",
      "203.0.113.20",
      "203.0.113.30"
    ]
  }`
});

const data = await response.json();
console.log(data);
curl --globoff -X PATCH 'https://api.hoody.com/api/v1/auth/tokens/{id}' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -d '{
  "ip_whitelist": [
    "203.0.113.10",
    "203.0.113.20",
    "203.0.113.30"
  ]
}'
$headers = @{
  'Content-Type' = 'application/json'
  'Authorization' = 'Bearer YOUR_TOKEN'
}

$body = @'
{
  "ip_whitelist": [
    "203.0.113.10",
    "203.0.113.20",
    "203.0.113.30"
  ]
}
'@

$response = Invoke-RestMethod -Uri 'https://api.hoody.com/api/v1/auth/tokens/{id}' `
  -Method PATCH `
  -Headers $headers `
  -Body $body

$response | ConvertTo-Json -Depth 100
PATCH Extend token expiration
https://api.hoody.com/api/v1/auth/tokens/{id}
const response = await fetch('https://api.hoody.com/api/v1/auth/tokens/{id}', {
  method: 'PATCH',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_TOKEN'
  },
  body: `{
    "expires_at": "2028-04-11T00:00:00Z"
  }`
});

const data = await response.json();
console.log(data);
curl --globoff -X PATCH 'https://api.hoody.com/api/v1/auth/tokens/{id}' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -d '{
  "expires_at": "2028-04-11T00:00:00Z"
}'
$headers = @{
  'Content-Type' = 'application/json'
  'Authorization' = 'Bearer YOUR_TOKEN'
}

$body = @'
{
  "expires_at": "2028-04-11T00:00:00Z"
}
'@

$response = Invoke-RestMethod -Uri 'https://api.hoody.com/api/v1/auth/tokens/{id}' `
  -Method PATCH `
  -Headers $headers `
  -Body $body

$response | ConvertTo-Json -Depth 100
Terminal window
# List all your auth tokens
hoody auth tokens list

The response lists each token’s settings:

{
"statusCode": 200,
"message": "Auth tokens retrieved successfully",
"data": [
{
"id": "63f8b0e5c9a1b2d3e4f5a6b7",
"alias": "CI-CD Pipeline",
"prefix": "hdy_",
"ip_whitelist": ["203.0.113.50/32"],
"expires_at": "2026-02-07T15:00:00.000Z",
"is_enabled": true,
"last_used_at": null,
"last_used_ip": null,
"created_at": "2025-11-09T10:00:00.000Z",
"updated_at": "2025-11-09T10:00:00.000Z"
}
]
}

Check expires_at and is_enabled on each token, and review its ip_whitelist. last_used_at and last_used_ip are always null: token usage is not reported. Review and rotate tokens regularly.

A token holding resources.create_tokens can create child tokens clamped to its own permissions, realms, IP whitelist and expiry; a child always expires. Each child’s delegation_depth is its parent’s plus one; 0 means created from a session. Delegation has a maximum depth, returned as data.restrictions.max_delegation_depth by GET /api/v1/auth/tokens/me; the default is 2. A child expires no later than its parent and the delegated lifetime limit, 90 days by default. Omitting expiry selects that ceiling; a later expiry or a child past the depth limit returns 403 TOKEN_CEILING_EXCEEDED. A token without resources.create_tokens cannot create more tokens, and a token created with deny_reauthorization: true never holds it. Leave resources.create_tokens off leaf tokens you hand to scripts.

Without the permission, the create answers 403 This token does not have permission: resources.create_tokens (auth tokens cannot manage auth tokens without it). Grant resources.create_tokens when you create the parent token, or create the token from a session. On a 2FA account, the script below finishes the login challenge and asks for a fresh code for the token gate:

Terminal window
# 1. Login to get a session
LOGIN_RESPONSE=$(curl -fsS -X POST "https://api.hoody.com/api/v1/users/auth/login" \
-H "Content-Type: application/json" \
-d '{"username": "your_username", "password": "your_password"}')
BODY='{}'
if [ "$(printf '%s' "$LOGIN_RESPONSE" | jq -r '.data.requires_2fa // false')" = "true" ]; then
TEMP_TOKEN=$(printf '%s' "$LOGIN_RESPONSE" | jq -er '.data.temp_token')
read -rp "2FA code: " OTP_CODE
LOGIN_RESPONSE=$(curl -fsS -X POST "https://api.hoody.com/api/v1/users/auth/2fa/verify" \
-H "Content-Type: application/json" \
-d '{"temp_token": "'"$TEMP_TOKEN"'", "code": "'"$OTP_CODE"'"}')
# The token gate needs a fresh code (skip it if you turned the gate off)
read -rp "New 2FA code for the token gate: " OTP_CODE
BODY=$(jq -n --arg c "$OTP_CODE" '{otp_code: $c}')
fi
JWT=$(printf '%s' "$LOGIN_RESPONSE" | jq -er '.data.token')
# 2. Create the auth token with the session
curl -fsS -X POST "https://api.hoody.com/api/v1/auth/tokens" \
-H "Authorization: Bearer $JWT" \
-H "Content-Type: application/json" \
-d "$(printf '%s' "$BODY" | jq '. + {
alias: "My Token",
expires_at: "2027-04-12T00:00:00Z",
permission_template: "full_access"
}')"

When a parent token is disabled, deleted or expires, every token below it stops authenticating. Bearer API requests return 401 INVALID_TOKEN with the message Invalid or expired token.

Auth tokens work with realm-scoped APIs ({realmId}.api.hoody.com); a token with no realm limit can also use the base host.

TokenWhere it works
realm_ids not emptyOnly those realm IDs, on realm-scoped hosts such as https://{realmId}.api.hoody.com
allow_no_realm: falseNot on the base host for resource operations
Either of the twoGET /api/v1/auth/tokens/me on https://api.hoody.com still answers, so a script can discover its allowed realms before choosing a realm host

GET /api/v1/users/me/security-history (CLI hoody users securityhistory list) records every successful sign-in. Each entry carries the event, a success or failed outcome, the IP address, the resolved country, the source channel and the timestamp.

ItemValue
include_failed=trueAdds rejected sign-in attempts. They are recorded only when a credential was checked against your account, so the endpoint cannot be used to probe whether an account exists
include_security=trueAdds other security events, such as 2FA changes, password resets, and token creation or revocation
Countrynull until resolved, and null for good for addresses that cannot be located
Retention180 days, append-only: you cannot delete entries, and neither can anyone who gets into your account

A burst of failed attempts, or a sign-in from a country you have never visited, is the clearest sign someone else is trying to get in. What is recorded and kept: Auditing & Data Collection.

// Do not do this
const response = await fetch('https://api.hoody.com/api/v1/projects/', {
headers: {
'Authorization': 'Bearer hdy_abc123hardcoded'
}
});

On an account with 2FA, login answers with requires_2fa and a temp_token instead of tokens. The two scripts below then exchange it at POST /api/v1/users/auth/2fa/verify with a code (Two-factor sign-in).

Terminal window
# 1. Login
LOGIN_RESPONSE=$(curl -X POST "https://api.hoody.com/api/v1/users/auth/login" \
-H "Content-Type: application/json" \
-d '{
"username": "dev_user",
"password": "strong_password_here"
}')
# Response includes tokens
# {
# "data": {
# "token": "eyJhbG...",
# "refreshToken": "eyJhbG...",
# "user": { ... }
# }
# }
# With 2FA on, exchange the temp_token and a code for the tokens
if [ "$(printf '%s' "$LOGIN_RESPONSE" | jq -r '.data.requires_2fa // false')" = "true" ]; then
TEMP_TOKEN=$(printf '%s' "$LOGIN_RESPONSE" | jq -er '.data.temp_token')
read -rp "2FA code: " OTP_CODE
LOGIN_RESPONSE=$(curl -fsS -X POST "https://api.hoody.com/api/v1/users/auth/2fa/verify" \
-H "Content-Type: application/json" \
-d '{"temp_token": "'"$TEMP_TOKEN"'", "code": "'"$OTP_CODE"'"}')
fi
# Capture the access and refresh tokens for steps 2-4
ACCESS_TOKEN=$(printf '%s' "$LOGIN_RESPONSE" | jq -r '.data.token')
REFRESH_TOKEN=$(printf '%s' "$LOGIN_RESPONSE" | jq -r '.data.refreshToken')
# 2. Use access token (valid 1 day)
curl "https://api.hoody.com/api/v1/projects/" \
-H "Authorization: Bearer $ACCESS_TOKEN"
# 3. Refresh before expiration (within 7 days)
# The refresh token goes in both the header and the body, and the two must match
REFRESH_RESPONSE=$(curl -fsS -X POST "https://api.hoody.com/api/v1/users/auth/refresh" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $REFRESH_TOKEN" \
-d '{"refreshToken": "'"$REFRESH_TOKEN"'"}')
ACCESS_TOKEN=$(printf '%s' "$REFRESH_RESPONSE" | jq -er '.data.token')
REFRESH_TOKEN=$(printf '%s' "$REFRESH_RESPONSE" | jq -er '.data.refreshToken')
# 4. Logout: ends every sign-in session of the account, this one included
# (to end only this one, DELETE /api/v1/users/auth/sessions/current)
curl -X POST "https://api.hoody.com/api/v1/users/auth/logout" \
-H "Authorization: Bearer $ACCESS_TOKEN"

This example allows requests from any IP address. For an IP-restricted token, use a runner with a static outbound IP and whitelist that address instead. On a 2FA account it asks for a code twice: once to finish login, and a fresh one for the token gate, which is on by default.

Terminal window
# 1. Login to get JWT
LOGIN_RESPONSE=$(curl -fsS -X POST "https://api.hoody.com/api/v1/users/auth/login" \
-H "Content-Type: application/json" \
-d '{"username": "your_username", "password": "your_password"}')
BODY='{}'
if [ "$(printf '%s' "$LOGIN_RESPONSE" | jq -r '.data.requires_2fa // false')" = "true" ]; then
TEMP_TOKEN=$(printf '%s' "$LOGIN_RESPONSE" | jq -er '.data.temp_token')
read -rp "2FA code: " OTP_CODE
LOGIN_RESPONSE=$(curl -fsS -X POST "https://api.hoody.com/api/v1/users/auth/2fa/verify" \
-H "Content-Type: application/json" \
-d '{"temp_token": "'"$TEMP_TOKEN"'", "code": "'"$OTP_CODE"'"}')
# The token gate needs a fresh code (skip it if you turned the gate off)
read -rp "New 2FA code for the token gate: " OTP_CODE
BODY=$(jq -n --arg c "$OTP_CODE" '{otp_code: $c}')
fi
JWT=$(printf '%s' "$LOGIN_RESPONSE" | jq -er '.data.token')
# 2. Create the CI token and store it straight in GitHub Secrets as HOODY_TOKEN
curl -fsS -X POST "https://api.hoody.com/api/v1/auth/tokens" \
-H "Authorization: Bearer $JWT" \
-H "Content-Type: application/json" \
-d "$(printf '%s' "$BODY" | jq '. + {
alias: "GitHub Actions Deployment",
ip_whitelist: ["*"],
permission_template: "full_access",
expires_at: "2027-04-12T00:00:00Z"
}')" | jq -er '.data.token' | gh secret set HOODY_TOKEN
# 3. Use in GitHub Actions workflow. Set the repository variable
# HOODY_COMPUTER_ID to the ID of the computer to start.
# - name: Deploy via Hoody API
# env:
# HOODY_TOKEN: ${{ secrets.HOODY_TOKEN }}
# COMPUTER_ID: ${{ vars.HOODY_COMPUTER_ID }}
# run: |
# curl -X POST "https://api.hoody.com/api/v1/computers/$COMPUTER_ID/start" \
# -H "Authorization: Bearer $HOODY_TOKEN"

An agent needs two things: a Hoody auth token in an environment variable, and an understanding of HTTP, which a model already has. There is no SDK to install and no training step. It never handles a password or manages credentials.

// AI agent configuration (environment variables)
const HOODY_TOKEN = process.env.HOODY_TOKEN; // hdy_... token
const projectId = process.env.HOODY_PROJECT_ID;
const serverId = process.env.HOODY_SERVER_ID;
const HOODY_API = 'https://api.hoody.com';
// Poll GET /api/v1/computers/{id} until the computer reaches a status
async function waitForStatus(computerId, status, headers) {
for (let i = 0; i < 60; i++) {
const res = await fetch(`${HOODY_API}/api/v1/computers/${computerId}`, { headers });
const { data } = await res.json();
if (data.status === status) return data;
await new Promise(r => setTimeout(r, 5000));
}
throw new Error(`Computer ${computerId} did not reach ${status}`);
}
// AI can now orchestrate infrastructure
async function aiAgentWorkflow(task) {
const headers = {
'Authorization': `Bearer ${HOODY_TOKEN}`,
'Content-Type': 'application/json'
};
// AI decides: "Need a computer to process this task"
const computer = await fetch(`${HOODY_API}/api/v1/projects/${projectId}/computers`, {
method: 'POST',
headers,
body: JSON.stringify({
name: `ai-task-${Date.now()}`,
server_id: serverId,
hoody_kit: true
})
}).then(r => r.json());
// Wait for computer to be running
await waitForStatus(computer.data.id, 'running', headers);
// Get computer URLs and use them
const terminalUrl = `https://${projectId}-${computer.data.id}-terminal-1.${computer.data.server_name}.computers.hoody.com`;
// AI executes commands in the new computer
const execution = await fetch(`${terminalUrl}/api/v1/terminal/execute`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ command: task.command })
});
if (!execution.ok) throw new Error(await execution.text());
let result = await execution.json();
// Under load the terminal can answer before the command ends: poll its result
while (result.status === 'running' || result.status === 'queued') {
await new Promise(r => setTimeout(r, 2000));
const poll = await fetch(`${terminalUrl}/api/v1/terminal/result/${result.command_id}`);
if (!poll.ok) throw new Error(await poll.text());
result = await poll.json();
}
if (result.status !== 'completed' || result.completion !== 'marker' || result.exit_code !== 0) {
throw new Error('Command did not complete successfully');
}
// AI snapshots only after the command succeeded
const snapshot = await fetch(`${HOODY_API}/api/v1/computers/${computer.data.id}/snapshots`, {
method: 'POST',
headers,
body: JSON.stringify({ alias: `task-${task.id}` })
});
if (!snapshot.ok) throw new Error(await snapshot.text());
return computer;
}

The same agent as a class that reads its settings from the environment:

// AI agent configuration file
// .env
HOODY_TOKEN=hdy_abc123def456...
HOODY_PROJECT_ID=63f8b0e5c9a1b2d3e4f5a6b7
// agent.js
import 'dotenv/config';
class HoodyAgent {
constructor() {
this.token = process.env.HOODY_TOKEN;
this.projectId = process.env.HOODY_PROJECT_ID;
this.api = 'https://api.hoody.com';
}
async callAPI(endpoint, options = {}) {
return fetch(`${this.api}${endpoint}`, {
...options,
headers: {
'Authorization': `Bearer ${this.token}`,
'Content-Type': 'application/json',
...options.headers
}
});
}
async spawnComputer(name, config) {
const response = await this.callAPI(
`/api/v1/projects/${this.projectId}/computers`,
{
method: 'POST',
body: JSON.stringify({
name,
server_id: config.serverId,
hoody_kit: true,
...config
})
}
);
return response.json();
}
async executeInComputer(computerId, command) {
// First get computer details to construct service URL
const computer = await this.callAPI(`/api/v1/computers/${computerId}`)
.then(r => r.json());
// Construct terminal URL
const terminalUrl = `https://${this.projectId}-${computerId}-terminal-1.${computer.data.server_name}.computers.hoody.com`;
// Execute command (no auth needed if computer permissions are open)
return fetch(`${terminalUrl}/api/v1/terminal/execute`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ command })
});
}
}
// AI uses this class for every Hoody operation
const agent = new HoodyAgent();
await agent.spawnComputer('ai-workspace', { serverId: 'server-123' });

Do not share a single token across systems. If one service is compromised, revoke only its token; the others keep working.

Terminal window
# Create separate tokens
POST /api/v1/auth/tokens { "alias": "GitHub Actions CI", ... }
POST /api/v1/auth/tokens { "alias": "Monitoring System", ... }
POST /api/v1/auth/tokens { "alias": "AI Agent Orchestrator", ... }

Short-lived, for temporary access:

{
"alias": "Contractor Access",
"expires_at": "2027-05-12T00:00:00Z",
"permission_template": "full_access"
}

Long-lived, for permanent infrastructure:

{
"alias": "Production Services",
"expires_at": "2027-04-12T00:00:00Z",
"permission_template": "full_access"
}

A token for a one-time operation, such as a migration, that expires on its own tomorrow:

POST Create a temporary token that auto-expires tomorrow
https://api.hoody.com/api/v1/auth/tokens
const response = await fetch('https://api.hoody.com/api/v1/auth/tokens', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_TOKEN'
  },
  body: `{
    "alias": "Migration Script",
    "permission_template": "full_access",
    "expires_at": "tomorrow",
    "ip_whitelist": [
      "YOUR_CURRENT_IP"
    ]
  }`
});

const data = await response.json();
console.log(data);
curl --globoff -X POST 'https://api.hoody.com/api/v1/auth/tokens' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -d '{
  "alias": "Migration Script",
  "permission_template": "full_access",
  "expires_at": "tomorrow",
  "ip_whitelist": [
    "YOUR_CURRENT_IP"
  ]
}'
$headers = @{
  'Content-Type' = 'application/json'
  'Authorization' = 'Bearer YOUR_TOKEN'
}

$body = @'
{
  "alias": "Migration Script",
  "permission_template": "full_access",
  "expires_at": "tomorrow",
  "ip_whitelist": [
    "YOUR_CURRENT_IP"
  ]
}
'@

$response = Invoke-RestMethod -Uri 'https://api.hoody.com/api/v1/auth/tokens' `
  -Method POST `
  -Headers $headers `
  -Body $body

$response | ConvertTo-Json -Depth 100

A token that only works from your office IP:

POST Create token that only works from your office IP
https://api.hoody.com/api/v1/auth/tokens
const response = await fetch('https://api.hoody.com/api/v1/auth/tokens', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_TOKEN'
  },
  body: `{
    "alias": "Office Automation",
    "ip_whitelist": [
      "203.0.113.50/32"
    ],
    "permission_template": "full_access"
  }`
});

const data = await response.json();
console.log(data);
curl --globoff -X POST 'https://api.hoody.com/api/v1/auth/tokens' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -d '{
  "alias": "Office Automation",
  "ip_whitelist": [
    "203.0.113.50/32"
  ],
  "permission_template": "full_access"
}'
$headers = @{
  'Content-Type' = 'application/json'
  'Authorization' = 'Bearer YOUR_TOKEN'
}

$body = @'
{
  "alias": "Office Automation",
  "ip_whitelist": [
    "203.0.113.50/32"
  ],
  "permission_template": "full_access"
}
'@

$response = Invoke-RestMethod -Uri 'https://api.hoody.com/api/v1/auth/tokens' `
  -Method POST `
  -Headers $headers `
  -Body $body

$response | ConvertTo-Json -Depth 100

A different token for each environment: development (permissive), staging (IP-restricted) and production (strict).

POST Create permissive development token
https://api.hoody.com/api/v1/auth/tokens
const response = await fetch('https://api.hoody.com/api/v1/auth/tokens', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_TOKEN'
  },
  body: `{
    "alias": "Development",
    "permission_template": "full_access",
    "ip_whitelist": [
      "*"
    ]
  }`
});

const data = await response.json();
console.log(data);
curl --globoff -X POST 'https://api.hoody.com/api/v1/auth/tokens' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -d '{
  "alias": "Development",
  "permission_template": "full_access",
  "ip_whitelist": [
    "*"
  ]
}'
$headers = @{
  'Content-Type' = 'application/json'
  'Authorization' = 'Bearer YOUR_TOKEN'
}

$body = @'
{
  "alias": "Development",
  "permission_template": "full_access",
  "ip_whitelist": [
    "*"
  ]
}
'@

$response = Invoke-RestMethod -Uri 'https://api.hoody.com/api/v1/auth/tokens' `
  -Method POST `
  -Headers $headers `
  -Body $body

$response | ConvertTo-Json -Depth 100
POST Create IP-restricted staging token
https://api.hoody.com/api/v1/auth/tokens
const response = await fetch('https://api.hoody.com/api/v1/auth/tokens', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_TOKEN'
  },
  body: `{
    "alias": "Staging",
    "permission_template": "full_access",
    "expires_at": "2027-07-11T00:00:00Z",
    "ip_whitelist": [
      "198.51.100.0/24"
    ]
  }`
});

const data = await response.json();
console.log(data);
curl --globoff -X POST 'https://api.hoody.com/api/v1/auth/tokens' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -d '{
  "alias": "Staging",
  "permission_template": "full_access",
  "expires_at": "2027-07-11T00:00:00Z",
  "ip_whitelist": [
    "198.51.100.0/24"
  ]
}'
$headers = @{
  'Content-Type' = 'application/json'
  'Authorization' = 'Bearer YOUR_TOKEN'
}

$body = @'
{
  "alias": "Staging",
  "permission_template": "full_access",
  "expires_at": "2027-07-11T00:00:00Z",
  "ip_whitelist": [
    "198.51.100.0/24"
  ]
}
'@

$response = Invoke-RestMethod -Uri 'https://api.hoody.com/api/v1/auth/tokens' `
  -Method POST `
  -Headers $headers `
  -Body $body

$response | ConvertTo-Json -Depth 100
POST Create strict production token
https://api.hoody.com/api/v1/auth/tokens
const response = await fetch('https://api.hoody.com/api/v1/auth/tokens', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_TOKEN'
  },
  body: `{
    "alias": "Production",
    "permission_template": "full_access",
    "expires_at": "2027-04-12T00:00:00Z",
    "ip_whitelist": [
      "203.0.113.10/32"
    ]
  }`
});

const data = await response.json();
console.log(data);
curl --globoff -X POST 'https://api.hoody.com/api/v1/auth/tokens' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -d '{
  "alias": "Production",
  "permission_template": "full_access",
  "expires_at": "2027-04-12T00:00:00Z",
  "ip_whitelist": [
    "203.0.113.10/32"
  ]
}'
$headers = @{
  'Content-Type' = 'application/json'
  'Authorization' = 'Bearer YOUR_TOKEN'
}

$body = @'
{
  "alias": "Production",
  "permission_template": "full_access",
  "expires_at": "2027-04-12T00:00:00Z",
  "ip_whitelist": [
    "203.0.113.10/32"
  ]
}
'@

$response = Invoke-RestMethod -Uri 'https://api.hoody.com/api/v1/auth/tokens' `
  -Method POST `
  -Headers $headers `
  -Body $body

$response | ConvertTo-Json -Depth 100

Save each block as a script and run it with bash, so a failed call stops the script, not your shell. From a session on a 2FA account with the token gate on (the default), add otp_code to the create and disable bodies. Run step 2 from an address the token’s IP whitelist allows.

Before running either script, export OLD_TOKEN_ID (the ID of the token being replaced) and ACCESS_TOKEN (a valid session access token): export OLD_TOKEN_ID='your-token-id' ACCESS_TOKEN='your-session-access-token'. Use the same values for both scripts.

#!/usr/bin/env bash
# rotate-1-create.sh: create the new token, save its value, check that it works
set -eo pipefail
umask 077
# 1. Create the new token; its value is shown only once, so write it to a file
curl -fsS -X POST "https://api.hoody.com/api/v1/auth/tokens/$OLD_TOKEN_ID/copy" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"alias": "Production V2", "expires_at": "2027-04-12T00:00:00Z"}' \
| jq -er '.data.token' > new-token.txt
# 2. Check that the new token authenticates
curl -fsS "https://api.hoody.com/api/v1/auth/tokens/me" \
-H "Authorization: Bearer $(cat new-token.txt)" | jq -er '.data.token.id'
echo "New token works. Deploy new-token.txt to every service, then run rotate-2-retire.sh"

Once every service runs on the new token:

#!/usr/bin/env bash
# rotate-2-retire.sh: disable, then delete, the old token
set -eo pipefail
# 3. Check the new token again before touching the old one
NEW_ID=$(curl -fsS "https://api.hoody.com/api/v1/auth/tokens/me" \
-H "Authorization: Bearer $(cat new-token.txt)" | jq -er '.data.token.id')
[ "$NEW_ID" != "$OLD_TOKEN_ID" ] || { echo "OLD_TOKEN_ID is the new token" >&2; exit 1; }
# 4. Disable the old token (reversible)
curl -fsS -X PATCH "https://api.hoody.com/api/v1/auth/tokens/$OLD_TOKEN_ID" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"is_enabled": false}' > /dev/null
# 5. Delete it only after you confirm every service still works
read -r -p "Every service still works? Type yes to delete the old token: " answer
[ "$answer" = "yes" ] || { echo "Stopped: the old token is disabled, not deleted; PATCH is_enabled true to restore it" >&2; exit 1; }
curl -fsS -X DELETE "https://api.hoody.com/api/v1/auth/tokens/$OLD_TOKEN_ID" \
-H "Authorization: Bearer $ACCESS_TOKEN" > /dev/null
echo "Old token deleted"
rm -f new-token.txt

If a token is compromised (on a 2FA account with the token gate on, add otp_code to each body):

In the Hub, open Keys and tokens in the sidebar, then on the API keys tab choose Pause on the key’s row. Press New key to make the replacement, set its Allowed IPv4 addresses and press Make key, then choose Delete… on the old row once your services use the new key. With the API:

  1. Disable it immediately:
PATCH Immediately disable compromised token
https://api.hoody.com/api/v1/auth/tokens/{id}
const response = await fetch('https://api.hoody.com/api/v1/auth/tokens/{id}', {
  method: 'PATCH',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_TOKEN'
  },
  body: `{
    "is_enabled": false
  }`
});

const data = await response.json();
console.log(data);
curl --globoff -X PATCH 'https://api.hoody.com/api/v1/auth/tokens/{id}' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -d '{
  "is_enabled": false
}'
$headers = @{
  'Content-Type' = 'application/json'
  'Authorization' = 'Bearer YOUR_TOKEN'
}

$body = @'
{
  "is_enabled": false
}
'@

$response = Invoke-RestMethod -Uri 'https://api.hoody.com/api/v1/auth/tokens/{id}' `
  -Method PATCH `
  -Headers $headers `
  -Body $body

$response | ConvertTo-Json -Depth 100
  1. Create a replacement with a different IP whitelist:
POST Create replacement token with new IP restrictions
https://api.hoody.com/api/v1/auth/tokens
const response = await fetch('https://api.hoody.com/api/v1/auth/tokens', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_TOKEN'
  },
  body: `{
    "alias": "Production Rotated",
    "permission_template": "full_access",
    "ip_whitelist": [
      "NEW_IP_RANGE"
    ],
    "expires_at": "2027-04-12T00:00:00Z"
  }`
});

const data = await response.json();
console.log(data);
curl --globoff -X POST 'https://api.hoody.com/api/v1/auth/tokens' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -d '{
  "alias": "Production Rotated",
  "permission_template": "full_access",
  "ip_whitelist": [
    "NEW_IP_RANGE"
  ],
  "expires_at": "2027-04-12T00:00:00Z"
}'
$headers = @{
  'Content-Type' = 'application/json'
  'Authorization' = 'Bearer YOUR_TOKEN'
}

$body = @'
{
  "alias": "Production Rotated",
  "permission_template": "full_access",
  "ip_whitelist": [
    "NEW_IP_RANGE"
  ],
  "expires_at": "2027-04-12T00:00:00Z"
}
'@

$response = Invoke-RestMethod -Uri 'https://api.hoody.com/api/v1/auth/tokens' `
  -Method POST `
  -Headers $headers `
  -Body $body

$response | ConvertTo-Json -Depth 100
  1. Update your services, then delete the old token:
DELETE Delete the compromised token after services are updated
https://api.hoody.com/api/v1/auth/tokens/{id}
const response = await fetch('https://api.hoody.com/api/v1/auth/tokens/{id}', {
  method: 'DELETE',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN'
  }
});

const data = await response.json();
console.log(data);
curl --globoff -X DELETE 'https://api.hoody.com/api/v1/auth/tokens/{id}' \
  -H 'Authorization: Bearer YOUR_TOKEN'
$headers = @{
  'Authorization' = 'Bearer YOUR_TOKEN'
}
$response = Invoke-RestMethod -Uri 'https://api.hoody.com/api/v1/auth/tokens/{id}' `
  -Method DELETE `
  -Headers $headers

$response | ConvertTo-Json -Depth 100
Symptom, status or messageCauseWhat to do
Login returns 401 Invalid credentialsThe username or password does not match exactlyCheck for typos
Login refused for an active-looking accountThe account may be banned (is_banned: true)Contact support if the account should be active
Requests return 401 after some timeThe access token expires after 1 dayRefresh, sending the refresh token in both the header and the body. Once the refresh token has expired too, after 7 days, log in again
A long-running script starts getting 401Its auth token reached expires_atCreate a replacement before the token expires. Account-created tokens can omit expires_at to remain valid indefinitely unless deny_reauthorization: true is set. Child tokens always expire within their parent’s expiry and the delegated lifetime limit
An hdy_... token returns 403 IP_NOT_ALLOWEDThe calling IP is not in its ip_whitelistCheck the whitelist and update it
An hdy_... token returns another 403Usually the token lacks the permission the endpoint needs: the message is This token does not have permission: <permission>. A token limited to realms also gets 403 outside its realms, and session-only endpoints refuse every auth tokenRead the message: grant the named permission or use a token that has it, call a realm host the token allows, or use a session for a session-only call
Scripts work sometimes and fail other times with 403An IP whitelist combined with a dynamic IPCheck the whitelist; use a CIDR range, ["*"] for non-sensitive automation, or a static IP for automation servers
Creating a token with another token returns 403The calling token lacks resources.create_tokensSee child tokens
400 OTP_REQUIRED on a token changeThe account has 2FA with the token gate on, and the call came from a sessionAdd otp_code
A session gets 401 SESSION_REVOKEDThe session was endedSign in again
The hdy_... value was not savedThe token value cannot be retrieved after creationReplace it

In the Hub, open Keys and tokens in the sidebar, then API keys, and choose Edit… on the key’s row to change its allowed IPv4 addresses.

With the API, read the token’s details, then compare the ip_whitelist array with your current IP (run curl https://ifconfig.me in a terminal):

GET Get token details to check IP whitelist
https://api.hoody.com/api/v1/auth/tokens/{id}
const response = await fetch('https://api.hoody.com/api/v1/auth/tokens/{id}', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN'
  }
});

const data = await response.json();
console.log(data);
curl --globoff -X GET 'https://api.hoody.com/api/v1/auth/tokens/{id}' \
  -H 'Authorization: Bearer YOUR_TOKEN'
$headers = @{
  'Authorization' = 'Bearer YOUR_TOKEN'
}
$response = Invoke-RestMethod -Uri 'https://api.hoody.com/api/v1/auth/tokens/{id}' `
  -Method GET `
  -Headers $headers

$response | ConvertTo-Json -Depth 100

Update the whitelist to include your current IP. On a 2FA account with the token gate on, add otp_code to each body.

PATCH Update token IP whitelist to include your current IP
https://api.hoody.com/api/v1/auth/tokens/{id}
const response = await fetch('https://api.hoody.com/api/v1/auth/tokens/{id}', {
  method: 'PATCH',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_TOKEN'
  },
  body: `{
    "ip_whitelist": [
      "YOUR_CURRENT_IP"
    ]
  }`
});

const data = await response.json();
console.log(data);
curl --globoff -X PATCH 'https://api.hoody.com/api/v1/auth/tokens/{id}' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -d '{
  "ip_whitelist": [
    "YOUR_CURRENT_IP"
  ]
}'
$headers = @{
  'Content-Type' = 'application/json'
  'Authorization' = 'Bearer YOUR_TOKEN'
}

$body = @'
{
  "ip_whitelist": [
    "YOUR_CURRENT_IP"
  ]
}
'@

$response = Invoke-RestMethod -Uri 'https://api.hoody.com/api/v1/auth/tokens/{id}' `
  -Method PATCH `
  -Headers $headers `
  -Body $body

$response | ConvertTo-Json -Depth 100

For a dynamic IP, use a CIDR range instead of a single IP: instead of "203.0.113.50/32", use "203.0.113.0/24", which allows the whole subnet. To lift IP restrictions for non-sensitive automation, set ip_whitelist to ["*"], which allows all:

PATCH Remove IP whitelist restrictions
https://api.hoody.com/api/v1/auth/tokens/{id}
const response = await fetch('https://api.hoody.com/api/v1/auth/tokens/{id}', {
  method: 'PATCH',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_TOKEN'
  },
  body: `{
    "ip_whitelist": [
      "*"
    ]
  }`
});

const data = await response.json();
console.log(data);
curl --globoff -X PATCH 'https://api.hoody.com/api/v1/auth/tokens/{id}' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -d '{
  "ip_whitelist": [
    "*"
  ]
}'
$headers = @{
  'Content-Type' = 'application/json'
  'Authorization' = 'Bearer YOUR_TOKEN'
}

$body = @'
{
  "ip_whitelist": [
    "*"
  ]
}
'@

$response = Invoke-RestMethod -Uri 'https://api.hoody.com/api/v1/auth/tokens/{id}' `
  -Method PATCH `
  -Headers $headers `
  -Body $body

$response | ConvertTo-Json -Depth 100

Disable the old token, then create a new one and save its value immediately. On a 2FA account with the token gate on, add otp_code to each body.

In the Hub, choose Copy with a new secret… on the key’s row on the API keys tab of Keys and tokens, choose Make copy, copy the new secret right away, then choose Pause or Delete… on the old key.

PATCH Disable the old token
https://api.hoody.com/api/v1/auth/tokens/{id}
const response = await fetch('https://api.hoody.com/api/v1/auth/tokens/{id}', {
  method: 'PATCH',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_TOKEN'
  },
  body: `{
    "is_enabled": false
  }`
});

const data = await response.json();
console.log(data);
curl --globoff -X PATCH 'https://api.hoody.com/api/v1/auth/tokens/{id}' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -d '{
  "is_enabled": false
}'
$headers = @{
  'Content-Type' = 'application/json'
  'Authorization' = 'Bearer YOUR_TOKEN'
}

$body = @'
{
  "is_enabled": false
}
'@

$response = Invoke-RestMethod -Uri 'https://api.hoody.com/api/v1/auth/tokens/{id}' `
  -Method PATCH `
  -Headers $headers `
  -Body $body

$response | ConvertTo-Json -Depth 100
POST Create a replacement token, and save the token value immediately
https://api.hoody.com/api/v1/auth/tokens
const response = await fetch('https://api.hoody.com/api/v1/auth/tokens', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_TOKEN'
  },
  body: `{
    "alias": "Replacement Token",
    "permission_template": "full_access",
    "expires_at": "2027-04-12T00:00:00Z"
  }`
});

const data = await response.json();
console.log(data);
curl --globoff -X POST 'https://api.hoody.com/api/v1/auth/tokens' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -d '{
  "alias": "Replacement Token",
  "permission_template": "full_access",
  "expires_at": "2027-04-12T00:00:00Z"
}'
$headers = @{
  'Content-Type' = 'application/json'
  'Authorization' = 'Bearer YOUR_TOKEN'
}

$body = @'
{
  "alias": "Replacement Token",
  "permission_template": "full_access",
  "expires_at": "2027-04-12T00:00:00Z"
}
'@

$response = Invoke-RestMethod -Uri 'https://api.hoody.com/api/v1/auth/tokens' `
  -Method POST `
  -Headers $headers `
  -Body $body

$response | ConvertTo-Json -Depth 100