Authentication reference
Section titled “Authentication reference”Lookup tables for authentication. Every field and status is in the Authentication API and the API tokens API.
Calls and credentials
Section titled “Calls and credentials”A session is the JWT from signing in; an auth token is an hdy_... token. “Own” means the token holds that permission.
| Call | What it does | Session | Auth token |
|---|---|---|---|
POST /api/v1/users/auth/login | Log in with username or email and password | None needed | None needed |
POST /api/v1/users/auth/2fa/verify | Complete login when the account has 2FA enabled | None needed, uses temp_token | None needed |
POST /api/v1/users/auth/refresh | Refresh the access token | The refresh token, as bearer and in the body | No |
GET /api/v1/users/auth/me | Get the current user profile | Full profile | Without 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/logout | Revoke all previously issued session JWTs for the token owner | Revokes them | Accepted, revokes nothing |
GET /api/v1/users/auth/sessions | List the places your account is signed in | Yes, on api.hoody.com | No (403) |
DELETE /api/v1/users/auth/sessions/{id} | End one sign-in session | Yes, on api.hoody.com | No (403) |
POST /api/v1/users/auth/sessions/revoke-others | End every sign-in session except this one | Yes, on api.hoody.com | No (403) |
POST /api/v1/users/auth/identity-claim | Re-issue an identity claim for one audience | Yes | No (403) |
GET /api/v1/users/me/security-history | List your sign-in and security-event history | Yes | Own resources.read_account, else 403 |
POST /api/v1/auth/tokens | Create a long-lived token | Yes; with 2FA and the token gate on, add otp_code | Own resources.create_tokens |
GET /api/v1/auth/tokens | List tokens | Your tokens visible in the current realm scope; the list can be truncated | Own resources.create_tokens; lists the tokens created under it |
GET /api/v1/auth/tokens/{id} | Get token details | Yes | Own resources.create_tokens, tokens created under it |
PATCH /api/v1/auth/tokens/{id} (PUT behaves the same) | Update token configuration | Yes; with 2FA and the token gate on, otp_code for rights, realms, IP whitelist, expiry or enabled state | Own resources.create_tokens, tokens created under it |
DELETE /api/v1/auth/tokens/{id} | Revoke the token | Yes | Own resources.create_tokens, tokens created under it |
POST /api/v1/auth/tokens/{id}/copy, /add-realm, /remove-realm | Copy a token; add or remove a realm | Yes; with 2FA and the token gate on, add otp_code | Own resources.create_tokens, tokens created under it |
GET /api/v1/auth/tokens/templates | List permission templates | Yes | No (403) |
GET /api/v1/auth/tokens/me | Read the calling token | No | Yes, on the base host too when limited to realms |
GET /api/v1/computers/{id}/env and its set and delete | Environment variables | Values shown | Values null without computers.features.env_values |
| Account money: wallet, transactions, invoices | Yes | Not from a token limited to realms (REALM_TOKEN_ACCOUNT_MONEY) | |
PUT or PATCH /api/v1/users/{id} | Update your profile | Yes | No (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.
Sessions and auth tokens compared
Section titled “Sessions and auth tokens compared”| Session (JWT from login) | Auth token (hdy_...) | |
|---|---|---|
| Lifetime | 1 day (access), 7 days (refresh) | Configurable: ISO 8601 date, today, tomorrow, or forever |
| Use case | User sessions | Automation, AI, scripts |
| Refresh | Yes, with the refresh token | No: create a new one when it expires |
| IP whitelist | No | Yes, optional |
| Revocation | Logout, called with a JWT, revokes all previously issued session JWTs for that owner | Delete or disable |
| Visibility | Managed by the browser | Shown once, at creation |
| Security | Short lifetime limits exposure | Long 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.
Sign-in
Section titled “Sign-in”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.
Use a session token
Section titled “Use a session token”# CLI stores the token automatically after loginhoody projects list// Pass token to client constructorconst client = new HoodyClient({ baseURL: 'https://api.hoody.com', token // from the login on the guide});const projects = await client.api.projects.list();# Include token in Authorization headercurl "https://api.hoody.com/api/v1/projects/" \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."List your projects using the access token from login. Paste in your own token before using the link.
https://PROJECT_ID-COMPUTER_ID-curl-1.SERVER.computers.hoody.com/api/v1/curl/request?url=https://api.hoody.com/api/v1/projects/&method=GET&bearer_token=ACCESS_TOKEN&response=transparentOne request, one link
cURL runs inside your computer and can wrap any HTTP request into a single GET URL. The call stops being something you need a client for and becomes something you can paste into a browser, send in a chat, bookmark, schedule with cron, or drop into a no-code tool.
Nothing is installed on the machine that opens it. The link does carry whatever credentials the call needs, so treat it as you would treat those credentials. It also appears in the cURL service's request log, not only the target's. Prefer a delegated token with minimal permissions and an expiry: see API tokens.
Slashes, colons and braces pass through as they are. The one character you must
encode is an & inside a value, which happens when the wrapped URL
carries its own query string. Left raw it ends the value early, and the rest is
read as cURL's own parameters, so you get a 200 on a request you did
not make.
How the wrapping works Chaining calls into one link Turning a link into a shortcut
Two-factor sign-in
Section titled “Two-factor sign-in”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:
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.
HTTP Basic with a password
Section titled “HTTP Basic with a password”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.
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:
| Resource | Writes that use up the code |
|---|---|
| Auth tokens | Creating 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 keys | Creating 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 |
| Computers | Creating 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 settings | Every 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 |
| Projects | Granting a project permission, raising a member’s permission level, or changing a project’s realm_ids |
| Pools | Inviting a member, or making a member admin |
| Storage shares | Creating a share; changing one to mode readwrite or enabled true; any change to expires_at, shortening it included |
| Your account | Changing 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.
Sign-in sessions
Section titled “Sign-in sessions”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.
| Item | Value |
|---|---|
| List order | The session making the request first |
| Each entry | How 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 sessions | state=ended lists those that ended in the last 180 days, with when and why |
| End this session | Use current as the id |
| After it ends | An 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 created | Keep 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 them | Only 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-ins | Up 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-ins | At 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.
Token options
Section titled “Token options”| Field | Accepts | Notes |
|---|---|---|
alias | ASCII letters, digits, spaces, _ and -, 1 to 254 characters, with at least one non-space character | Whitespace-only aliases return 400; slashes and parentheses are rejected (422 validation error) |
permissions | A tree such as { "projects": { "read": true } } | A path left out is false. Every path: permission paths |
permission_template | full_access, external_customer, dev_team, finance_team, read_only | Takes precedence over permissions. For production, replace full_access with an explicit tree of the operations the automation needs |
| Neither of the two | Omitting 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_whitelist | IPv4 addresses and CIDR ranges, or ["*"] | ["*"] allows all. An empty array is rejected, because the array form needs at least one entry |
expires_at | See the formats below | From a session, omit it and the token never expires; a token created by another token always expires |
realm_ids, allow_no_realm | Realm IDs; true or false | See tokens limited to realms. Token realms do not count toward your realm limit |
deny_reauthorization | true | Removes 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_code | An authenticator or backup code | Required 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"}{ "expires_at": 1830297599}{ "expires_at": "tomorrow"}Accepts today (expires at midnight tonight) or tomorrow (expires in 24 hours).
{ "alias": "Production Services", "permission_template": "full_access"}Omit expires_at entirely on create from a session and the token never expires, unless deny_reauthorization: true caps it. "expires_at": null is refused on create; PATCH or PUT /api/v1/auth/tokens/{id} and POST /api/v1/auth/tokens/{id}/copy accept it to clear an existing expiry. A delegated token cannot be made permanent.
A token with an IP whitelist for a CI/CD pipeline:
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.
Update a token
Section titled “Update a token”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.
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 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 Audit tokens
Section titled “Audit tokens”# List all your auth tokenshoody auth tokens list// client: signed in with a session token (see Use a session token)const tokens = await client.api.auth.tokens.list();tokens.data.forEach(t => { console.log(t.alias, t.is_enabled, t.expires_at);});curl "https://api.hoody.com/api/v1/auth/tokens" \ -H "Authorization: Bearer $ACCESS_TOKEN"List your Auth Tokens visible in the current realm scope, including expiry, enabled state and IP whitelist. At most 1,000 entries are considered before realm filtering; truncated: true means the result may omit tokens.
https://PROJECT_ID-COMPUTER_ID-curl-1.SERVER.computers.hoody.com/api/v1/curl/request?url=https://api.hoody.com/api/v1/auth/tokens&method=GET&bearer_token=ACCESS_TOKEN&response=transparentOne request, one link
cURL runs inside your computer and can wrap any HTTP request into a single GET URL. The call stops being something you need a client for and becomes something you can paste into a browser, send in a chat, bookmark, schedule with cron, or drop into a no-code tool.
Nothing is installed on the machine that opens it. The link does carry whatever credentials the call needs, so treat it as you would treat those credentials. It also appears in the cURL service's request log, not only the target's. Prefer a delegated token with minimal permissions and an expiry: see API tokens.
Slashes, colons and braces pass through as they are. The one character you must
encode is an & inside a value, which happens when the wrapped URL
carries its own query string. Left raw it ends the value early, and the rest is
read as cURL's own parameters, so you get a 200 on a request you did
not make.
How the wrapping works Chaining calls into one link Turning a link into a shortcut
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.
Child tokens
Section titled “Child tokens”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:
# 1. Login to get a sessionLOGIN_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}')fiJWT=$(printf '%s' "$LOGIN_RESPONSE" | jq -er '.data.token')
# 2. Create the auth token with the sessioncurl -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.
Tokens limited to realms
Section titled “Tokens limited to realms”Auth tokens work with realm-scoped APIs ({realmId}.api.hoody.com); a token with no realm limit can also use the base host.
| Token | Where it works |
|---|---|
realm_ids not empty | Only those realm IDs, on realm-scoped hosts such as https://{realmId}.api.hoody.com |
allow_no_realm: false | Not on the base host for resource operations |
| Either of the two | GET /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 |
Security history
Section titled “Security history”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.
| Item | Value |
|---|---|
include_failed=true | Adds 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=true | Adds other security events, such as 2FA changes, password resets, and token creation or revocation |
| Country | null until resolved, and null for good for addresses that cannot be located |
| Retention | 180 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.
Recipes
Section titled “Recipes”Keep credentials out of code
Section titled “Keep credentials out of code”// Do not do thisconst response = await fetch('https://api.hoody.com/api/v1/projects/', { headers: { 'Authorization': 'Bearer hdy_abc123hardcoded' }});// Use environment variablesconst response = await fetch('https://api.hoody.com/api/v1/projects/', { headers: { 'Authorization': `Bearer ${process.env.HOODY_TOKEN}` }});Log in from a script
Section titled “Log in from a script”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).
# 1. LoginLOGIN_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 tokensif [ "$(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-4ACCESS_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 matchREFRESH_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"Create a token for CI
Section titled “Create a token for CI”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.
# 1. Login to get JWTLOGIN_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}')fiJWT=$(printf '%s' "$LOGIN_RESPONSE" | jq -er '.data.token')
# 2. Create the CI token and store it straight in GitHub Secrets as HOODY_TOKENcurl -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"AI agents
Section titled “AI agents”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_... tokenconst 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 statusasync 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 infrastructureasync 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// .envHOODY_TOKEN=hdy_abc123def456...HOODY_PROJECT_ID=63f8b0e5c9a1b2d3e4f5a6b7
// agent.jsimport '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 operationconst agent = new HoodyAgent();await agent.spawnComputer('ai-workspace', { serverId: 'server-123' });One token per service
Section titled “One token per service”Do not share a single token across systems. If one service is compromised, revoke only its token; the others keep working.
# Create separate tokensPOST /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"}Short-lived and per-environment tokens
Section titled “Short-lived and per-environment tokens”A token for a one-time operation, such as a migration, that expires on its own tomorrow:
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:
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).
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 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 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 Rotate a token
Section titled “Rotate a token”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 worksset -eo pipefailumask 077
# 1. Create the new token; its value is shown only once, so write it to a filecurl -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 authenticatescurl -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 tokenset -eo pipefail
# 3. Check the new token again before touching the old oneNEW_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 worksread -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/nullecho "Old token deleted"rm -f new-token.txtEmergency revocation
Section titled “Emergency revocation”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:
- Disable it immediately:
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 - Create a replacement with a different IP whitelist:
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 - Update your services, then delete the old token:
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 Troubleshooting
Section titled “Troubleshooting”| Symptom, status or message | Cause | What to do |
|---|---|---|
Login returns 401 Invalid credentials | The username or password does not match exactly | Check for typos |
| Login refused for an active-looking account | The account may be banned (is_banned: true) | Contact support if the account should be active |
Requests return 401 after some time | The access token expires after 1 day | Refresh, 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 401 | Its auth token reached expires_at | Create 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_ALLOWED | The calling IP is not in its ip_whitelist | Check the whitelist and update it |
An hdy_... token returns another 403 | Usually 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 token | Read 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 403 | An IP whitelist combined with a dynamic IP | Check the whitelist; use a CIDR range, ["*"] for non-sensitive automation, or a static IP for automation servers |
Creating a token with another token returns 403 | The calling token lacks resources.create_tokens | See child tokens |
400 OTP_REQUIRED on a token change | The account has 2FA with the token gate on, and the call came from a session | Add otp_code |
A session gets 401 SESSION_REVOKED | The session was ended | Sign in again |
The hdy_... value was not saved | The token value cannot be retrieved after creation | Replace it |
Check a token’s IP whitelist
Section titled “Check a token’s IP whitelist”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):
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.
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:
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 Replace a lost token
Section titled “Replace a lost token”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.
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 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