curl --request POST \
--url https://app.hookie.ai/admin/api/projects/{project_id}/portals/{portal_id}/tokens \
--header 'Content-Type: application/json' \
--cookie hookie_session= \
--data '
{
"customer_id": "<string>",
"scopes": [],
"expires_in_days": 123,
"customer_name": "<string>"
}
'const options = {
method: 'POST',
headers: {cookie: 'hookie_session=', 'Content-Type': 'application/json'},
body: JSON.stringify({
customer_id: '<string>',
scopes: [],
expires_in_days: 123,
customer_name: '<string>'
})
};
fetch('https://app.hookie.ai/admin/api/projects/{project_id}/portals/{portal_id}/tokens', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.hookie.ai/admin/api/projects/{project_id}/portals/{portal_id}/tokens"
payload = {
"customer_id": "<string>",
"scopes": [],
"expires_in_days": 123,
"customer_name": "<string>"
}
headers = {
"cookie": "hookie_session=",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"ok": true,
"destinations_disabled": 1
}{
"id": "<string>",
"token": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}{
"error": "<string>",
"retry_after": 123,
"upgrade_url": "<string>",
"reason": "<string>",
"code": "agent_scope_insufficient",
"required_scope": "hookie:read",
"granted_scopes": [
"<string>"
],
"manage_url": "<string>",
"scheme": "<string>",
"max_members": 123,
"members": 123,
"customer_id": "<string>",
"customer_name": "<string>",
"account_id": "<string>",
"terms_version": "<string>",
"claim_required": true
}{
"error": "<string>",
"retry_after": 123,
"upgrade_url": "<string>",
"reason": "<string>",
"code": "agent_scope_insufficient",
"required_scope": "hookie:read",
"granted_scopes": [
"<string>"
],
"manage_url": "<string>",
"scheme": "<string>",
"max_members": 123,
"members": 123,
"customer_id": "<string>",
"customer_name": "<string>",
"account_id": "<string>",
"terms_version": "<string>",
"claim_required": true
}{
"error": "<string>",
"retry_after": 123,
"upgrade_url": "<string>",
"reason": "<string>",
"code": "agent_scope_insufficient",
"required_scope": "hookie:read",
"granted_scopes": [
"<string>"
],
"manage_url": "<string>",
"scheme": "<string>",
"max_members": 123,
"members": 123,
"customer_id": "<string>",
"customer_name": "<string>",
"account_id": "<string>",
"terms_version": "<string>",
"claim_required": true
}{
"error": "<string>",
"retry_after": 123,
"upgrade_url": "<string>",
"reason": "<string>",
"code": "agent_scope_insufficient",
"required_scope": "hookie:read",
"granted_scopes": [
"<string>"
],
"manage_url": "<string>",
"scheme": "<string>",
"max_members": 123,
"members": 123,
"customer_id": "<string>",
"customer_name": "<string>",
"account_id": "<string>",
"terms_version": "<string>",
"claim_required": true
}{
"error": "This portal already serves customer 'acme' (Acme Inc). A customer portal serves one customer, so its events never reach anyone else. Issue this token for 'acme', or offboard them first (Offboard customer in the console, or POST {\"offboard\": \"<customer_id>\"} to this route: it revokes their tokens and switches their endpoints off), or give the new customer their own project and portal.",
"reason": "portal_customer_mismatch",
"customer_id": "acme",
"customer_name": "Acme Inc"
}{
"error": "<string>",
"retry_after": 123,
"upgrade_url": "<string>",
"reason": "<string>",
"code": "agent_scope_insufficient",
"required_scope": "hookie:read",
"granted_scopes": [
"<string>"
],
"manage_url": "<string>",
"scheme": "<string>",
"max_members": 123,
"members": 123,
"customer_id": "<string>",
"customer_name": "<string>",
"account_id": "<string>",
"terms_version": "<string>",
"claim_required": true
}{
"error": "<string>",
"retry_after": 123,
"upgrade_url": "<string>",
"reason": "<string>",
"code": "agent_scope_insufficient",
"required_scope": "hookie:read",
"granted_scopes": [
"<string>"
],
"manage_url": "<string>",
"scheme": "<string>",
"max_members": 123,
"members": 123,
"customer_id": "<string>",
"customer_name": "<string>",
"account_id": "<string>",
"terms_version": "<string>",
"claim_required": true
}Issue or revoke a portal access token
One customer per portal (PORT-2g, #321). A portal’s events are not scoped to a customer: every customer endpoint on a portal receives every event of each dataset the portal exposes. So a portal serves exactly one customer, and a vendor isolates customers by giving each one its own project and portal. Issuing a token whose customer_id differs from the portal’s current customer (anyone holding a live token, not revoked and not expired, or still having an endpoint that is on) is a 409 with reason: "portal_customer_mismatch". The check is made by the insert itself, so two concurrent issues for different customers cannot both succeed. The same customer can hold several tokens. Revoking a customer’s last token or offboarding them switches their endpoints off and frees the portal for a new customer. Switching an offboarded customer’s endpoint back on (enabled: true on the destination) is refused the same way while the portal serves someone else, and a portal customer’s own create or enable re-checks their token inside the write (401 once it is revoked).
curl --request POST \
--url https://app.hookie.ai/admin/api/projects/{project_id}/portals/{portal_id}/tokens \
--header 'Content-Type: application/json' \
--cookie hookie_session= \
--data '
{
"customer_id": "<string>",
"scopes": [],
"expires_in_days": 123,
"customer_name": "<string>"
}
'const options = {
method: 'POST',
headers: {cookie: 'hookie_session=', 'Content-Type': 'application/json'},
body: JSON.stringify({
customer_id: '<string>',
scopes: [],
expires_in_days: 123,
customer_name: '<string>'
})
};
fetch('https://app.hookie.ai/admin/api/projects/{project_id}/portals/{portal_id}/tokens', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.hookie.ai/admin/api/projects/{project_id}/portals/{portal_id}/tokens"
payload = {
"customer_id": "<string>",
"scopes": [],
"expires_in_days": 123,
"customer_name": "<string>"
}
headers = {
"cookie": "hookie_session=",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"ok": true,
"destinations_disabled": 1
}{
"id": "<string>",
"token": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}{
"error": "<string>",
"retry_after": 123,
"upgrade_url": "<string>",
"reason": "<string>",
"code": "agent_scope_insufficient",
"required_scope": "hookie:read",
"granted_scopes": [
"<string>"
],
"manage_url": "<string>",
"scheme": "<string>",
"max_members": 123,
"members": 123,
"customer_id": "<string>",
"customer_name": "<string>",
"account_id": "<string>",
"terms_version": "<string>",
"claim_required": true
}{
"error": "<string>",
"retry_after": 123,
"upgrade_url": "<string>",
"reason": "<string>",
"code": "agent_scope_insufficient",
"required_scope": "hookie:read",
"granted_scopes": [
"<string>"
],
"manage_url": "<string>",
"scheme": "<string>",
"max_members": 123,
"members": 123,
"customer_id": "<string>",
"customer_name": "<string>",
"account_id": "<string>",
"terms_version": "<string>",
"claim_required": true
}{
"error": "<string>",
"retry_after": 123,
"upgrade_url": "<string>",
"reason": "<string>",
"code": "agent_scope_insufficient",
"required_scope": "hookie:read",
"granted_scopes": [
"<string>"
],
"manage_url": "<string>",
"scheme": "<string>",
"max_members": 123,
"members": 123,
"customer_id": "<string>",
"customer_name": "<string>",
"account_id": "<string>",
"terms_version": "<string>",
"claim_required": true
}{
"error": "<string>",
"retry_after": 123,
"upgrade_url": "<string>",
"reason": "<string>",
"code": "agent_scope_insufficient",
"required_scope": "hookie:read",
"granted_scopes": [
"<string>"
],
"manage_url": "<string>",
"scheme": "<string>",
"max_members": 123,
"members": 123,
"customer_id": "<string>",
"customer_name": "<string>",
"account_id": "<string>",
"terms_version": "<string>",
"claim_required": true
}{
"error": "This portal already serves customer 'acme' (Acme Inc). A customer portal serves one customer, so its events never reach anyone else. Issue this token for 'acme', or offboard them first (Offboard customer in the console, or POST {\"offboard\": \"<customer_id>\"} to this route: it revokes their tokens and switches their endpoints off), or give the new customer their own project and portal.",
"reason": "portal_customer_mismatch",
"customer_id": "acme",
"customer_name": "Acme Inc"
}{
"error": "<string>",
"retry_after": 123,
"upgrade_url": "<string>",
"reason": "<string>",
"code": "agent_scope_insufficient",
"required_scope": "hookie:read",
"granted_scopes": [
"<string>"
],
"manage_url": "<string>",
"scheme": "<string>",
"max_members": 123,
"members": 123,
"customer_id": "<string>",
"customer_name": "<string>",
"account_id": "<string>",
"terms_version": "<string>",
"claim_required": true
}{
"error": "<string>",
"retry_after": 123,
"upgrade_url": "<string>",
"reason": "<string>",
"code": "agent_scope_insufficient",
"required_scope": "hookie:read",
"granted_scopes": [
"<string>"
],
"manage_url": "<string>",
"scheme": "<string>",
"max_members": 123,
"members": 123,
"customer_id": "<string>",
"customer_name": "<string>",
"account_id": "<string>",
"terms_version": "<string>",
"claim_required": true
}Authorizations
The console's sealed session cookie, set by WorkOS AuthKit. Mutating requests also require the X-Requested-With CSRF header.
Headers
Makes a POST safe to retry for 24 hours: the same key, credential, path and body returns the stored response (Idempotent-Replayed: true) instead of running again. 422 if the key was used for a different request; 409 while the first is in flight.
1 - 255Body
- Issue
- Revoke
- Offboard
One endpoint, three modes, discriminated by the presence of a string revoke or offboard.
The tenant's own identifier for their end customer. Trimmed; must be non-empty. Compared exactly (case-sensitive) with the portal's current customer: a different id is a 409 (PORT-2g).
1Stored on the token but not enforced by the portal API today.
Must be finite and > 0 to take effect; anything else means the token never expires. The console defaults it to 30. A portal session made from the token never outlives it.
Optional display name, shown to the customer in the portal instead of the id (#198). Trimmed; over 80 characters is a 400.
80