API Reference
Generated TokPortal OpenAPI reference with curl, Node, Python, and Go examples for every operation.
API Reference
This page is generated from the public OpenAPI schema. Do not edit it by hand.
Generated operations: 82.
Profile
Get authenticated user
GET /me
Operation ID: getCurrentUser
| Status | Description |
|---|---|
200 | Authenticated user profile and credit balance. |
401 | Missing, invalid, or revoked API key. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Examples
curl
curl -X GET "https://app.tokportal.com/api/ext/me" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/me', {
method: 'GET',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'GET',
'https://app.tokportal.com/api/ext/me',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("GET", "https://app.tokportal.com/api/ext/me", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Update safe workspace settings
PATCH /me
Operation ID: updateCurrentUserSettings
Updates client-owned workspace profile fields used by Operator context. Does not expose auth, role, credit, staff, or manager settings.
Request body: application/json (UpdateCurrentUserSettingsRequest)
| Status | Description |
|---|---|
200 | Updated safe workspace settings. |
400 | Invalid workspace setting. |
401 | Missing, invalid, or revoked API key. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X PATCH "https://app.tokportal.com/api/ext/me" \
-H "X-API-Key: sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"company_name": "company_name",
"website": "website",
"company_niche": "company_niche",
"organic_strategy": "organic_strategy"
}'
Node
const response = await fetch('https://app.tokportal.com/api/ext/me', {
method: 'PATCH',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"company_name": "company_name",
"website": "website",
"company_niche": "company_niche",
"organic_strategy": "organic_strategy"
})
});
const data = await response.json();
Python
response = requests.request(
'PATCH',
'https://app.tokportal.com/api/ext/me',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]},
json={
"company_name": "company_name",
"website": "website",
"company_niche": "company_niche",
"organic_strategy": "organic_strategy"
}
)
print(response.json())
Go
req, _ := http.NewRequest("PATCH", "https://app.tokportal.com/api/ext/me", strings.NewReader("{\n \"company_name\": \"company_name\",\n \"website\": \"website\",\n \"company_niche\": \"company_niche\",\n \"organic_strategy\": \"organic_strategy\"\n}"))
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
Reference
List available countries
GET /countries
Operation ID: listCountries
| Status | Description |
|---|---|
200 | Enabled country codes available for account creation. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
Examples
curl
curl -X GET "https://app.tokportal.com/api/ext/countries"
Node
const response = await fetch('https://app.tokportal.com/api/ext/countries', {
method: 'GET',
headers: {
}
});
const data = await response.json();
Python
response = requests.request(
'GET',
'https://app.tokportal.com/api/ext/countries',
headers={}
)
print(response.json())
Go
req, _ := http.NewRequest("GET", "https://app.tokportal.com/api/ext/countries", nil)
resp, err := http.DefaultClient.Do(req)
List available platforms
GET /platforms
Operation ID: listPlatforms
| Status | Description |
|---|---|
200 | Supported social platforms. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
Examples
curl
curl -X GET "https://app.tokportal.com/api/ext/platforms"
Node
const response = await fetch('https://app.tokportal.com/api/ext/platforms', {
method: 'GET',
headers: {
}
});
const data = await response.json();
Python
response = requests.request(
'GET',
'https://app.tokportal.com/api/ext/platforms',
headers={}
)
print(response.json())
Go
req, _ := http.NewRequest("GET", "https://app.tokportal.com/api/ext/platforms", nil)
resp, err := http.DefaultClient.Do(req)
Credits
Get credit pricing
GET /credit-costs
Operation ID: getCreditCosts
| Status | Description |
|---|---|
200 | Current credit cost table. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
Examples
curl
curl -X GET "https://app.tokportal.com/api/ext/credit-costs"
Node
const response = await fetch('https://app.tokportal.com/api/ext/credit-costs', {
method: 'GET',
headers: {
}
});
const data = await response.json();
Python
response = requests.request(
'GET',
'https://app.tokportal.com/api/ext/credit-costs',
headers={}
)
print(response.json())
Go
req, _ := http.NewRequest("GET", "https://app.tokportal.com/api/ext/credit-costs", nil)
resp, err := http.DefaultClient.Do(req)
Get credit balance
GET /credits/balance
Operation ID: getCreditBalance
| Status | Description |
|---|---|
200 | Current credit balance. |
401 | Missing, invalid, or revoked API key. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Examples
curl
curl -X GET "https://app.tokportal.com/api/ext/credits/balance" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/credits/balance', {
method: 'GET',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'GET',
'https://app.tokportal.com/api/ext/credits/balance',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("GET", "https://app.tokportal.com/api/ext/credits/balance", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
List credit transactions
GET /credits/history
Operation ID: listCreditTransactions
| Parameter | In | Required | Description |
|---|---|---|---|
page | query | No | Page number. |
per_page | query | No | Items per page. |
date_from | query | No | Filter transactions created on or after this date. |
date_to | query | No | Filter transactions created before the day after this date. |
| Status | Description |
|---|---|
200 | Paginated credit transaction history. |
401 | Missing, invalid, or revoked API key. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Examples
curl
curl -X GET "https://app.tokportal.com/api/ext/credits/history?page=example&per_page=example" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/credits/history?page=example&per_page=example', {
method: 'GET',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'GET',
'https://app.tokportal.com/api/ext/credits/history?page=example&per_page=example',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("GET", "https://app.tokportal.com/api/ext/credits/history?page=example&per_page=example", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Bundles
List bundles
GET /bundles
Operation ID: listBundles
| Parameter | In | Required | Description |
|---|---|---|---|
page | query | No | Page number. |
per_page | query | No | Items per page. |
status | query | No | Filter by bundle status. |
bundle_type | query | No | |
platform | query | No | |
external_ref | query | No | |
account_status | query | No |
| Status | Description |
|---|---|
200 | Paginated bundle list. |
401 | Missing, invalid, or revoked API key. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Examples
curl
curl -X GET "https://app.tokportal.com/api/ext/bundles?page=example&per_page=example" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/bundles?page=example&per_page=example', {
method: 'GET',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'GET',
'https://app.tokportal.com/api/ext/bundles?page=example&per_page=example',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("GET", "https://app.tokportal.com/api/ext/bundles?page=example&per_page=example", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Create a bundle
POST /bundles
Operation ID: createBundle
Creates an account-only, account-and-videos, or videos-only bundle. Credit cost is calculated server-side.
Request body: application/json (CreateBundleRequest)
| Status | Description |
|---|---|
201 | Bundle created. |
400 | Invalid request body or business rule violation. |
401 | Missing, invalid, or revoked API key. |
402 | Insufficient credits. |
409 | Duplicate or invalid state. |
429 | Create rate limit exceeded. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X POST "https://app.tokportal.com/api/ext/bundles" \
-H "X-API-Key: sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"bundle_type": "account_only"
}'
Node
const response = await fetch('https://app.tokportal.com/api/ext/bundles', {
method: 'POST',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"bundle_type": "account_only"
})
});
const data = await response.json();
Python
response = requests.request(
'POST',
'https://app.tokportal.com/api/ext/bundles',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]},
json={
"bundle_type": "account_only"
}
)
print(response.json())
Go
req, _ := http.NewRequest("POST", "https://app.tokportal.com/api/ext/bundles", strings.NewReader("{\n \"bundle_type\": \"account_only\"\n}"))
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
Create bundles in bulk
POST /bundles/bulk
Operation ID: createBundlesBulk
Request body: application/json (CreateBulkBundlesRequest)
| Status | Description |
|---|---|
201 | Bulk bundle creation result. |
400 | Invalid request body or business rule violation. |
401 | Missing, invalid, or revoked API key. |
402 | Insufficient credits. |
429 | Create rate limit exceeded. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X POST "https://app.tokportal.com/api/ext/bundles/bulk" \
-H "X-API-Key: sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"platforms": [
"tiktok"
],
"country": "USA",
"accounts_count": 25
}'
Node
const response = await fetch('https://app.tokportal.com/api/ext/bundles/bulk', {
method: 'POST',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"platforms": [
"tiktok"
],
"country": "USA",
"accounts_count": 25
})
});
const data = await response.json();
Python
response = requests.request(
'POST',
'https://app.tokportal.com/api/ext/bundles/bulk',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]},
json={
"platforms": [
"tiktok"
],
"country": "USA",
"accounts_count": 25
}
)
print(response.json())
Go
req, _ := http.NewRequest("POST", "https://app.tokportal.com/api/ext/bundles/bulk", strings.NewReader("{\n \"platforms\": [\n \"tiktok\"\n ],\n \"country\": \"USA\",\n \"accounts_count\": 25\n}"))
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
Get a bundle
GET /bundles/{id}
Operation ID: getBundle
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Bundle ID. |
| Status | Description |
|---|---|
200 | Bundle details. |
401 | Missing, invalid, or revoked API key. |
404 | Bundle not found. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Examples
curl
curl -X GET "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c', {
method: 'GET',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'GET',
'https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("GET", "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Update bundle settings
PATCH /bundles/{id}
Operation ID: updateBundle
Updates mutable bundle metadata such as title, external_ref, and auto_finalize_videos.
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Bundle ID. |
Request body: application/json (PatchBundleRequest)
| Status | Description |
|---|---|
200 | Bundle updated. |
400 | Invalid patch body. |
401 | Missing, invalid, or revoked API key. |
403 | Bundle belongs to another account. |
404 | Bundle not found. |
409 | Duplicate external_ref. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X PATCH "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c" \
-H "X-API-Key: sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"auto_finalize_videos": false,
"external_ref": "external_ref",
"title": "Launch campaign"
}'
Node
const response = await fetch('https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c', {
method: 'PATCH',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"auto_finalize_videos": false,
"external_ref": "external_ref",
"title": "Launch campaign"
})
});
const data = await response.json();
Python
response = requests.request(
'PATCH',
'https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]},
json={
"auto_finalize_videos": false,
"external_ref": "external_ref",
"title": "Launch campaign"
}
)
print(response.json())
Go
req, _ := http.NewRequest("PATCH", "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c", strings.NewReader("{\n \"auto_finalize_videos\": false,\n \"external_ref\": \"external_ref\",\n \"title\": \"Launch campaign\"\n}"))
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
Publish a bundle
POST /bundles/{id}/publish
Operation ID: publishBundle
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Bundle ID. |
| Status | Description |
|---|---|
200 | Publish result. |
401 | Missing, invalid, or revoked API key. |
402 | Insufficient credits. |
404 | Bundle not found. |
409 | Bundle is not ready or is in an invalid state. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X POST "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/publish" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/publish', {
method: 'POST',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'POST',
'https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/publish',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("POST", "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/publish", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Check bundle publish readiness
GET /bundles/{id}/publish-readiness
Operation ID: getBundlePublishReadiness
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Bundle ID. |
| Status | Description |
|---|---|
200 | Readiness blockers and ready flag. |
401 | Missing, invalid, or revoked API key. |
404 | Bundle not found. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Examples
curl
curl -X GET "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/publish-readiness" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/publish-readiness', {
method: 'GET',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'GET',
'https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/publish-readiness',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("GET", "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/publish-readiness", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Unpublish a bundle
POST /bundles/{id}/unpublish
Operation ID: unpublishBundle
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Bundle ID. |
| Status | Description |
|---|---|
200 | Unpublish result. |
401 | Missing, invalid, or revoked API key. |
404 | Bundle not found. |
409 | Bundle is in an invalid state. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X POST "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/unpublish" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/unpublish', {
method: 'POST',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'POST',
'https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/unpublish',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("POST", "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/unpublish", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Add video slots to a bundle
POST /bundles/{id}/add-video-slots
Operation ID: addVideoSlots
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Bundle ID. |
Request body: application/json (QuantityRequest)
| Status | Description |
|---|---|
200 | Created video slots. |
400 | Invalid quantity or bundle type. |
401 | Missing, invalid, or revoked API key. |
402 | Insufficient credits. |
404 | Bundle not found. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X POST "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/add-video-slots" \
-H "X-API-Key: sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"quantity": 1
}'
Node
const response = await fetch('https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/add-video-slots', {
method: 'POST',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"quantity": 1
})
});
const data = await response.json();
Python
response = requests.request(
'POST',
'https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/add-video-slots',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]},
json={
"quantity": 1
}
)
print(response.json())
Go
req, _ := http.NewRequest("POST", "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/add-video-slots", strings.NewReader("{\n \"quantity\": 1\n}"))
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
Add edit slots to a bundle
POST /bundles/{id}/add-edit-slots
Operation ID: addEditSlots
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Bundle ID. |
Request body: application/json (QuantityRequest)
| Status | Description |
|---|---|
200 | Created edit slots. |
400 | Invalid quantity. |
401 | Missing, invalid, or revoked API key. |
402 | Insufficient credits. |
404 | Bundle not found. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X POST "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/add-edit-slots" \
-H "X-API-Key: sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"quantity": 1
}'
Node
const response = await fetch('https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/add-edit-slots', {
method: 'POST',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"quantity": 1
})
});
const data = await response.json();
Python
response = requests.request(
'POST',
'https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/add-edit-slots',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]},
json={
"quantity": 1
}
)
print(response.json())
Go
req, _ := http.NewRequest("POST", "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/add-edit-slots", strings.NewReader("{\n \"quantity\": 1\n}"))
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
Account Configuration
Get bundle account configuration
GET /bundles/{id}/account
Operation ID: getBundleAccount
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Bundle ID. |
| Status | Description |
|---|---|
200 | Account configuration. |
401 | Missing, invalid, or revoked API key. |
404 | Bundle or account not found. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Examples
curl
curl -X GET "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/account" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/account', {
method: 'GET',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'GET',
'https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/account',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("GET", "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/account", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Configure bundle account profile
PUT /bundles/{id}/account
Operation ID: configureBundleAccount
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Bundle ID. |
Request body: application/json (ConfigureAccountRequest)
| Status | Description |
|---|---|
200 | Configured account. |
400 | Invalid account profile. |
401 | Missing, invalid, or revoked API key. |
404 | Bundle or account not found. |
409 | Account status does not allow configuration. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X PUT "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/account" \
-H "X-API-Key: sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"username": "username",
"visible_name": "visible_name"
}'
Node
const response = await fetch('https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/account', {
method: 'PUT',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"username": "username",
"visible_name": "visible_name"
})
});
const data = await response.json();
Python
response = requests.request(
'PUT',
'https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/account',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]},
json={
"username": "username",
"visible_name": "visible_name"
}
)
print(response.json())
Go
req, _ := http.NewRequest("PUT", "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/account", strings.NewReader("{\n \"username\": \"username\",\n \"visible_name\": \"visible_name\"\n}"))
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
Request account corrections
POST /bundles/{id}/account/corrections
Operation ID: requestBundleAccountCorrections
Moves an in-review account back to pending corrections with reviewer feedback.
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Bundle ID. |
Request body: application/json (AccountCorrectionsRequest)
| Status | Description |
|---|---|
200 | Account corrections requested. |
400 | Invalid correction body. |
401 | Missing, invalid, or revoked API key. |
404 | Bundle or account not found. |
409 | Account is not in review. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X POST "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/account/corrections" \
-H "X-API-Key: sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"comment": "Please review this item."
}'
Node
const response = await fetch('https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/account/corrections', {
method: 'POST',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"comment": "Please review this item."
})
});
const data = await response.json();
Python
response = requests.request(
'POST',
'https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/account/corrections',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]},
json={
"comment": "Please review this item."
}
)
print(response.json())
Go
req, _ := http.NewRequest("POST", "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/account/corrections", strings.NewReader("{\n \"comment\": \"Please review this item.\"\n}"))
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
Finalize account review
POST /bundles/{id}/account/finalize
Operation ID: finalizeBundleAccount
Approves an in-review account and marks it finalized.
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Bundle ID. |
| Status | Description |
|---|---|
200 | Account finalized. |
401 | Missing, invalid, or revoked API key. |
404 | Bundle or account not found. |
409 | Account is not in review. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X POST "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/account/finalize" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/account/finalize', {
method: 'POST',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'POST',
'https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/account/finalize',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("POST", "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/account/finalize", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Videos
List bundle video slots
GET /bundles/{id}/videos
Operation ID: listBundleVideos
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Bundle ID. |
| Status | Description |
|---|---|
200 | Video slots for the bundle. |
401 | Missing, invalid, or revoked API key. |
404 | Bundle not found. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Examples
curl
curl -X GET "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos', {
method: 'GET',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'GET',
'https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("GET", "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Get video slot configuration
GET /bundles/{id}/videos/{position}
Operation ID: getBundleVideo
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Bundle ID. |
position | path | Yes | 1-based video slot position. |
| Status | Description |
|---|---|
200 | Video slot configuration. |
401 | Missing, invalid, or revoked API key. |
404 | Bundle or video slot not found. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Examples
curl
curl -X GET "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/1" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/1', {
method: 'GET',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'GET',
'https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/1',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("GET", "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/1", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Configure a video slot
PUT /bundles/{id}/videos/{position}
Operation ID: configureBundleVideo
Configure a slot as a video, carousel, or story. A story (TikTok/Instagram only) is a single video OR a single image (provide exactly one of video_url or story_image_url), has no description, and is verified by an account-manager screenshot. The optional story_repost_url makes the story repost an existing post from the SAME platform and costs +1 credit.
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Bundle ID. |
position | path | Yes | 1-based video slot position. |
Request body: application/json (ConfigureVideoRequest)
| Status | Description |
|---|---|
200 | Configured video slot. |
400 | Invalid video metadata. |
401 | Missing, invalid, or revoked API key. |
404 | Bundle or video slot not found. |
409 | Video status does not allow configuration. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X PUT "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/1" \
-H "X-API-Key: sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"video_type": "video",
"target_publish_date": "target_publish_date"
}'
Node
const response = await fetch('https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/1', {
method: 'PUT',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"video_type": "video",
"target_publish_date": "target_publish_date"
})
});
const data = await response.json();
Python
response = requests.request(
'PUT',
'https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/1',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]},
json={
"video_type": "video",
"target_publish_date": "target_publish_date"
}
)
print(response.json())
Go
req, _ := http.NewRequest("PUT", "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/1", strings.NewReader("{\n \"video_type\": \"video\",\n \"target_publish_date\": \"target_publish_date\"\n}"))
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
Patch video metadata or schedule
PATCH /bundles/{id}/videos/{position}
Operation ID: patchBundleVideo
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Bundle ID. |
position | path | Yes | 1-based video slot position. |
Request body: application/json (PatchVideoRequest)
| Status | Description |
|---|---|
200 | Patched video slot. |
400 | Invalid patch body. |
401 | Missing, invalid, or revoked API key. |
404 | Bundle or video slot not found. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X PATCH "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/1" \
-H "X-API-Key: sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"external_ref": "external_ref",
"name": "name",
"description": "Campaign content description.",
"target_publish_date": "target_publish_date"
}'
Node
const response = await fetch('https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/1', {
method: 'PATCH',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"external_ref": "external_ref",
"name": "name",
"description": "Campaign content description.",
"target_publish_date": "target_publish_date"
})
});
const data = await response.json();
Python
response = requests.request(
'PATCH',
'https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/1',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]},
json={
"external_ref": "external_ref",
"name": "name",
"description": "Campaign content description.",
"target_publish_date": "target_publish_date"
}
)
print(response.json())
Go
req, _ := http.NewRequest("PATCH", "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/1", strings.NewReader("{\n \"external_ref\": \"external_ref\",\n \"name\": \"name\",\n \"description\": \"Campaign content description.\",\n \"target_publish_date\": \"target_publish_date\"\n}"))
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
Configure video slots in bulk
PUT /bundles/{id}/videos/batch
Operation ID: batchConfigureBundleVideos
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Bundle ID. |
Request body: application/json (BatchConfigureVideosRequest)
| Status | Description |
|---|---|
200 | Batch video configuration result. |
400 | Invalid batch body. |
401 | Missing, invalid, or revoked API key. |
404 | Bundle not found. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X PUT "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/batch" \
-H "X-API-Key: sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"videos": [
{
"video_type": "video",
"target_publish_date": "target_publish_date",
"position": 1
}
]
}'
Node
const response = await fetch('https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/batch', {
method: 'PUT',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"videos": [
{
"video_type": "video",
"target_publish_date": "target_publish_date",
"position": 1
}
]
})
});
const data = await response.json();
Python
response = requests.request(
'PUT',
'https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/batch',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]},
json={
"videos": [
{
"video_type": "video",
"target_publish_date": "target_publish_date",
"position": 1
}
]
}
)
print(response.json())
Go
req, _ := http.NewRequest("PUT", "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/batch", strings.NewReader("{\n \"videos\": [\n {\n \"video_type\": \"video\",\n \"target_publish_date\": \"target_publish_date\",\n \"position\": 1\n }\n ]\n}"))
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
Publish all configured videos on an active bundle
POST /bundles/{id}/videos/publish-all
Operation ID: publishAllBundleVideos
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Bundle ID. |
| Status | Description |
|---|---|
200 | Published video slots. |
401 | Missing, invalid, or revoked API key. |
404 | Bundle not found. |
409 | Bundle status does not allow publishing videos. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X POST "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/publish-all" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/publish-all', {
method: 'POST',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'POST',
'https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/publish-all',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("POST", "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/publish-all", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Import video slots from CSV
POST /bundles/{id}/videos/import-csv
Operation ID: importBundleVideosCsv
Uploads a CSV file, downloads referenced media, and configures available video slots.
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Bundle ID. |
Request body: multipart/form-data (multipart form)
| Status | Description |
|---|---|
200 | CSV import result. |
400 | Invalid CSV or upload body. |
401 | Missing, invalid, or revoked API key. |
404 | Bundle not found. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X POST "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/import-csv" \
-H "X-API-Key: sk_your_key_here" \
-F "file=@/path/to/file"
Node
const response = await fetch('https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/import-csv', {
method: 'POST',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'POST',
'https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/import-csv',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("POST", "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/import-csv", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Publish one video slot
POST /bundles/{id}/videos/{position}/publish
Operation ID: publishBundleVideo
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Bundle ID. |
position | path | Yes | 1-based video slot position. |
| Status | Description |
|---|---|
200 | Video slot published. |
401 | Missing, invalid, or revoked API key. |
404 | Bundle or video slot not found. |
409 | Bundle or video status does not allow publishing. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X POST "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/1/publish" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/1/publish', {
method: 'POST',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'POST',
'https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/1/publish',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("POST", "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/1/publish", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Reset one video slot
POST /bundles/{id}/videos/{position}/reset
Operation ID: resetBundleVideo
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Bundle ID. |
position | path | Yes | 1-based video slot position. |
| Status | Description |
|---|---|
200 | Video slot reset. |
401 | Missing, invalid, or revoked API key. |
404 | Bundle or video slot not found. |
409 | Video status does not allow reset. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X POST "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/1/reset" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/1/reset', {
method: 'POST',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'POST',
'https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/1/reset',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("POST", "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/1/reset", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Unschedule one video slot
POST /bundles/{id}/videos/{position}/unschedule
Operation ID: unscheduleBundleVideo
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Bundle ID. |
position | path | Yes | 1-based video slot position. |
| Status | Description |
|---|---|
200 | Video slot unscheduled. |
401 | Missing, invalid, or revoked API key. |
404 | Bundle or video slot not found. |
409 | Video status does not allow unscheduling. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X POST "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/1/unschedule" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/1/unschedule', {
method: 'POST',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'POST',
'https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/1/unschedule',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("POST", "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/1/unschedule", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Finalize video review
POST /bundles/{id}/videos/{position}/finalize
Operation ID: finalizeBundleVideo
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Bundle ID. |
position | path | Yes | 1-based video slot position. |
| Status | Description |
|---|---|
200 | Video slot finalized. |
401 | Missing, invalid, or revoked API key. |
404 | Bundle or video slot not found. |
409 | Video is not in review. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X POST "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/1/finalize" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/1/finalize', {
method: 'POST',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'POST',
'https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/1/finalize',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("POST", "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/1/finalize", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Request video corrections
POST /bundles/{id}/videos/{position}/corrections
Operation ID: requestBundleVideoCorrections
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Bundle ID. |
position | path | Yes | 1-based video slot position. |
Request body: application/json (VideoCorrectionsRequest)
| Status | Description |
|---|---|
200 | Video corrections requested. |
400 | Invalid correction body. |
401 | Missing, invalid, or revoked API key. |
404 | Bundle or video slot not found. |
409 | Video is not in review. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X POST "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/1/corrections" \
-H "X-API-Key: sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"comment": "Please review this item."
}'
Node
const response = await fetch('https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/1/corrections', {
method: 'POST',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"comment": "Please review this item."
})
});
const data = await response.json();
Python
response = requests.request(
'POST',
'https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/1/corrections',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]},
json={
"comment": "Please review this item."
}
)
print(response.json())
Go
req, _ := http.NewRequest("POST", "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/1/corrections", strings.NewReader("{\n \"comment\": \"Please review this item.\"\n}"))
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
Fix a broken video download
POST /bundles/{id}/videos/{position}/fix-download
Operation ID: fixBundleVideoDownload
Replaces a manager-flagged broken video or carousel download URL and clears the download issue flag.
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Bundle ID. |
position | path | Yes | 1-based video slot position. |
Request body: application/json (FixVideoDownloadRequest)
| Status | Description |
|---|---|
200 | Video download issue fixed. |
400 | Invalid replacement media body. |
401 | Missing, invalid, or revoked API key. |
404 | Bundle or video slot not found. |
409 | Video does not have a download issue. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X POST "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/1/fix-download" \
-H "X-API-Key: sk_your_key_here" \
-H "Content-Type: application/json" \
-d '"value"'
Node
const response = await fetch('https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/1/fix-download', {
method: 'POST',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
'Content-Type': 'application/json',
},
body: JSON.stringify("value")
});
const data = await response.json();
Python
response = requests.request(
'POST',
'https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/1/fix-download',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]},
json="value"
)
print(response.json())
Go
req, _ := http.NewRequest("POST", "https://app.tokportal.com/api/ext/bundles/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/videos/1/fix-download", strings.NewReader("\"value\""))
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
Request an ad code (TikTok Spark Code / Instagram Partner Code) for a finalized video
POST /videos/{id}/ad-code-request
Operation ID: createVideoAdCodeRequest
Requests an ad code (TikTok Spark Code or Instagram Partner Code) for one finalized video and debits 7 credits. The video must be finalized on TikTok or Instagram, with a live post link, and belong to an order with an assigned manager. Only one open request per video at a time. Poll the GET endpoint to retrieve the code once the manager submits it.
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Video ID. |
Request body: application/json (AdCodeRequest)
| Status | Description |
|---|---|
201 | Ad code request created. |
400 | Invalid request, no assigned manager, or platform not available. |
401 | Missing, invalid, or revoked API key. |
402 | Insufficient credits. |
404 | Video not found. |
409 | Video not finalized or an open request already exists. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X POST "https://app.tokportal.com/api/ext/videos/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/ad-code-request" \
-H "X-API-Key: sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"note": "note",
"platform": "tiktok"
}'
Node
const response = await fetch('https://app.tokportal.com/api/ext/videos/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/ad-code-request', {
method: 'POST',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"note": "note",
"platform": "tiktok"
})
});
const data = await response.json();
Python
response = requests.request(
'POST',
'https://app.tokportal.com/api/ext/videos/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/ad-code-request',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]},
json={
"note": "note",
"platform": "tiktok"
}
)
print(response.json())
Go
req, _ := http.NewRequest("POST", "https://app.tokportal.com/api/ext/videos/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/ad-code-request", strings.NewReader("{\n \"note\": \"note\",\n \"platform\": \"tiktok\"\n}"))
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
Get / poll the ad code for a video
GET /videos/{id}/ad-code-request
Operation ID: getVideoAdCodeRequest
Returns the latest ad code request for the video. The code field is null until the manager submits it (status in_review) or it is delivered (status finalized).
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Video ID. |
| Status | Description |
|---|---|
200 | Latest ad code request (or null). |
401 | Missing, invalid, or revoked API key. |
404 | Video not found. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Examples
curl
curl -X GET "https://app.tokportal.com/api/ext/videos/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/ad-code-request" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/videos/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/ad-code-request', {
method: 'GET',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'GET',
'https://app.tokportal.com/api/ext/videos/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/ad-code-request',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("GET", "https://app.tokportal.com/api/ext/videos/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/ad-code-request", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Accounts
List delivered accounts
GET /accounts
Operation ID: listAccounts
| Parameter | In | Required | Description |
|---|---|---|---|
page | query | No | Page number. |
per_page | query | No | Items per page. |
platform | query | No | Filter by platform. |
country | query | No | Filter by country code or country alias. |
| Status | Description |
|---|---|
200 | Paginated delivered account list. |
401 | Missing, invalid, or revoked API key. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Examples
curl
curl -X GET "https://app.tokportal.com/api/ext/accounts?page=example&per_page=example" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/accounts?page=example&per_page=example', {
method: 'GET',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'GET',
'https://app.tokportal.com/api/ext/accounts?page=example&per_page=example',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("GET", "https://app.tokportal.com/api/ext/accounts?page=example&per_page=example", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Get a delivered account
GET /accounts/{id}
Operation ID: getAccount
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Saved account ID. |
| Status | Description |
|---|---|
200 | Delivered account details. |
401 | Missing, invalid, or revoked API key. |
404 | Account not found. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Examples
curl
curl -X GET "https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c', {
method: 'GET',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'GET',
'https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("GET", "https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Update account commenting profile
PATCH /accounts/{id}/commenting-profile
Operation ID: updateAccountCommentingProfile
Updates client-owned commenting/autopilot profile fields for a delivered account. The account must belong to the API key owner.
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Saved account ID. |
Request body: application/json (UpdateAccountCommentingProfileRequest)
| Status | Description |
|---|---|
200 | Updated account commenting profile. |
400 | Invalid commenting profile body. |
401 | Missing, invalid, or revoked API key. |
404 | Account not found. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X PATCH "https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/commenting-profile" \
-H "X-API-Key: sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"niche": "niche",
"persona": "persona",
"goal": "promotion",
"language": "language"
}'
Node
const response = await fetch('https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/commenting-profile', {
method: 'PATCH',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"niche": "niche",
"persona": "persona",
"goal": "promotion",
"language": "language"
})
});
const data = await response.json();
Python
response = requests.request(
'PATCH',
'https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/commenting-profile',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]},
json={
"niche": "niche",
"persona": "persona",
"goal": "promotion",
"language": "language"
}
)
print(response.json())
Go
req, _ := http.NewRequest("PATCH", "https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/commenting-profile", strings.NewReader("{\n \"niche\": \"niche\",\n \"persona\": \"persona\",\n \"goal\": \"promotion\",\n \"language\": \"language\"\n}"))
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
List bundles for a delivered account
GET /accounts/{id}/bundles
Operation ID: listAccountBundles
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Saved account ID. |
page | query | No | Page number. |
per_page | query | No | Items per page. |
status | query | No | Filter by bundle status. |
| Status | Description |
|---|---|
200 | Paginated bundles for account. |
401 | Missing, invalid, or revoked API key. |
404 | Account not found. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Examples
curl
curl -X GET "https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/bundles?page=example&per_page=example" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/bundles?page=example&per_page=example', {
method: 'GET',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'GET',
'https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/bundles?page=example&per_page=example',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("GET", "https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/bundles?page=example&per_page=example", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Retrieve latest account verification code
POST /accounts/{id}/verification-code
Operation ID: retrieveAccountVerificationCode
Retrieving a verification code counts as logging in outside TokPortal and permanently voids TokPortal support for the account. The first retrieval on an account requires the explicit acknowledgment flag in the body; without it the request fails with 428 and the disclaimer text.
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Saved account ID. |
Request body: application/json (AcknowledgeSupportForfeitRequest)
| Status | Description |
|---|---|
200 | Verification code result. |
401 | Missing, invalid, or revoked API key. |
402 | Owning fee required. |
404 | Account or verification code not found. |
428 | Support-forfeit acknowledgment required. Retry with {"acknowledge_support_forfeit": true} after confirming the disclaimer. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X POST "https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/verification-code" \
-H "X-API-Key: sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"acknowledge_support_forfeit": false
}'
Node
const response = await fetch('https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/verification-code', {
method: 'POST',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"acknowledge_support_forfeit": false
})
});
const data = await response.json();
Python
response = requests.request(
'POST',
'https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/verification-code',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]},
json={
"acknowledge_support_forfeit": false
}
)
print(response.json())
Go
req, _ := http.NewRequest("POST", "https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/verification-code", strings.NewReader("{\n \"acknowledge_support_forfeit\": false\n}"))
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
Reveal delivered account credentials
POST /accounts/{id}/reveal-credentials
Operation ID: revealAccountCredentials
Revealing credentials permanently voids TokPortal support for the account — no replacement or refund request will be considered afterward. The first reveal on an account requires the explicit acknowledgment flag in the body; without it the request fails with 428 and the disclaimer text, and nothing is revealed.
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Saved account ID. |
Request body: application/json (AcknowledgeSupportForfeitRequest)
| Status | Description |
|---|---|
200 | Credentials reveal result. |
401 | Missing, invalid, or revoked API key. |
402 | Owning fee required. |
404 | Account not found. |
428 | Support-forfeit acknowledgment required. Retry with {"acknowledge_support_forfeit": true} after confirming the disclaimer. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X POST "https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/reveal-credentials" \
-H "X-API-Key: sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"acknowledge_support_forfeit": false
}'
Node
const response = await fetch('https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/reveal-credentials', {
method: 'POST',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"acknowledge_support_forfeit": false
})
});
const data = await response.json();
Python
response = requests.request(
'POST',
'https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/reveal-credentials',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]},
json={
"acknowledge_support_forfeit": false
}
)
print(response.json())
Go
req, _ := http.NewRequest("POST", "https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/reveal-credentials", strings.NewReader("{\n \"acknowledge_support_forfeit\": false\n}"))
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
Get active account edit request
GET /accounts/{id}/edit-request
Operation ID: getAccountEditRequest
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Saved account ID. |
| Status | Description |
|---|---|
200 | Active edit request. |
401 | Missing, invalid, or revoked API key. |
404 | Account not found. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Examples
curl
curl -X GET "https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/edit-request" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/edit-request', {
method: 'GET',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'GET',
'https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/edit-request',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("GET", "https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/edit-request", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Request profile edits for a delivered account
POST /accounts/{id}/edit-request
Operation ID: createAccountEditRequest
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Saved account ID. |
Request body: application/json (AccountEditRequest)
| Status | Description |
|---|---|
201 | Edit request created. |
400 | Invalid edit request. |
401 | Missing, invalid, or revoked API key. |
404 | Account not found. |
409 | An active edit request already exists. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X POST "https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/edit-request" \
-H "X-API-Key: sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"requested_username": "requested_username",
"requested_visible_name": "requested_visible_name"
}'
Node
const response = await fetch('https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/edit-request', {
method: 'POST',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"requested_username": "requested_username",
"requested_visible_name": "requested_visible_name"
})
});
const data = await response.json();
Python
response = requests.request(
'POST',
'https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/edit-request',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]},
json={
"requested_username": "requested_username",
"requested_visible_name": "requested_visible_name"
}
)
print(response.json())
Go
req, _ := http.NewRequest("POST", "https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/edit-request", strings.NewReader("{\n \"requested_username\": \"requested_username\",\n \"requested_visible_name\": \"requested_visible_name\"\n}"))
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
Analytics
Check analytics refresh availability
GET /accounts/{id}/analytics/can-refresh
Operation ID: canRefreshAccountAnalytics
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Saved account ID. |
| Status | Description |
|---|---|
200 | Manual refresh availability. |
401 | Missing, invalid, or revoked API key. |
404 | Account not found. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Examples
curl
curl -X GET "https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/analytics/can-refresh" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/analytics/can-refresh', {
method: 'GET',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'GET',
'https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/analytics/can-refresh',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("GET", "https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/analytics/can-refresh", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Refresh account analytics
POST /accounts/{id}/analytics/refresh
Operation ID: refreshAccountAnalytics
Backward-compatible account analytics refresh path. Supports forced refresh and post import options.
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Saved account ID. |
Request body: application/json (RefreshAnalyticsRequest)
| Status | Description |
|---|---|
200 | Refresh result. |
401 | Missing, invalid, or revoked API key. |
403 | Plan does not include this analytics level. |
404 | Account not found. |
429 | Manual refresh cooldown active. |
502 | Refresh provider failed. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X POST "https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/analytics/refresh" \
-H "X-API-Key: sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"force": false,
"includePosts": false,
"includeComments": false,
"forcePosts": false
}'
Node
const response = await fetch('https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/analytics/refresh', {
method: 'POST',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"force": false,
"includePosts": false,
"includeComments": false,
"forcePosts": false
})
});
const data = await response.json();
Python
response = requests.request(
'POST',
'https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/analytics/refresh',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]},
json={
"force": false,
"includePosts": false,
"includeComments": false,
"forcePosts": false
}
)
print(response.json())
Go
req, _ := http.NewRequest("POST", "https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/analytics/refresh", strings.NewReader("{\n \"force\": false,\n \"includePosts\": false,\n \"includeComments\": false,\n \"forcePosts\": false\n}"))
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
Get analytics dashboard
GET /analytics
Operation ID: getAnalyticsDashboard
| Parameter | In | Required | Description |
|---|---|---|---|
workspace | query | No | |
platform | query | No | Repeatable platform filter. |
country | query | No | Repeatable country filter. |
account | query | No | Repeatable account filter. |
from | query | No | |
to | query | No |
| Status | Description |
|---|---|
200 | Analytics dashboard data. |
401 | Missing, invalid, or revoked API key. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Examples
curl
curl -X GET "https://app.tokportal.com/api/ext/analytics?workspace=example&platform=example" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/analytics?workspace=example&platform=example', {
method: 'GET',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'GET',
'https://app.tokportal.com/api/ext/analytics?workspace=example&platform=example',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("GET", "https://app.tokportal.com/api/ext/analytics?workspace=example&platform=example", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Get analytics data contract
GET /analytics/contract
Operation ID: getAnalyticsContract
Returns the Analytics v2 contract, current access payload, metric semantics, freshness targets, and redaction rules.
| Status | Description |
|---|---|
200 | Analytics contract and access payload. |
401 | Missing, invalid, or revoked API key. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Examples
curl
curl -X GET "https://app.tokportal.com/api/ext/analytics/contract" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/analytics/contract', {
method: 'GET',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'GET',
'https://app.tokportal.com/api/ext/analytics/contract',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("GET", "https://app.tokportal.com/api/ext/analytics/contract", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Export analytics videos CSV
GET /analytics/export/videos
Operation ID: exportAnalyticsVideos
| Parameter | In | Required | Description |
|---|---|---|---|
account | query | No | Repeatable account filter. |
workspace | query | No | |
platform | query | No | Repeatable platform filter. |
country | query | No | Repeatable country filter. |
q | query | No | Search query. |
from | query | No | |
to | query | No |
| Status | Description |
|---|---|
200 | CSV export of analytics video rows. |
401 | Missing, invalid, or revoked API key. |
403 | Plan does not include this analytics level. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Examples
curl
curl -X GET "https://app.tokportal.com/api/ext/analytics/export/videos?account=example&workspace=example" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/analytics/export/videos?account=example&workspace=example', {
method: 'GET',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'GET',
'https://app.tokportal.com/api/ext/analytics/export/videos?account=example&workspace=example',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("GET", "https://app.tokportal.com/api/ext/analytics/export/videos?account=example&workspace=example", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Create analytics web report
POST /analytics/export/reports
Operation ID: createAnalyticsReport
Creates a shareable Analytics v2 web report and returns its token and URL.
Request body: application/json (CreateAnalyticsReportRequest)
| Status | Description |
|---|---|
200 | Created analytics report. |
400 | Invalid report request. |
401 | Missing, invalid, or revoked API key. |
403 | Plan does not include this analytics level. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X POST "https://app.tokportal.com/api/ext/analytics/export/reports" \
-H "X-API-Key: sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"title": "Launch campaign",
"template": "template",
"brandName": "brandName",
"brandAccent": "brandAccent"
}'
Node
const response = await fetch('https://app.tokportal.com/api/ext/analytics/export/reports', {
method: 'POST',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"title": "Launch campaign",
"template": "template",
"brandName": "brandName",
"brandAccent": "brandAccent"
})
});
const data = await response.json();
Python
response = requests.request(
'POST',
'https://app.tokportal.com/api/ext/analytics/export/reports',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]},
json={
"title": "Launch campaign",
"template": "template",
"brandName": "brandName",
"brandAccent": "brandAccent"
}
)
print(response.json())
Go
req, _ := http.NewRequest("POST", "https://app.tokportal.com/api/ext/analytics/export/reports", strings.NewReader("{\n \"title\": \"Launch campaign\",\n \"template\": \"template\",\n \"brandName\": \"brandName\",\n \"brandAccent\": \"brandAccent\"\n}"))
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
Export analytics report HTML
POST /analytics/export/reports/html
Operation ID: exportAnalyticsReportHtml
Creates a standalone downloadable HTML analytics report.
Request body: application/json (CreateAnalyticsReportRequest)
| Status | Description |
|---|---|
200 | Standalone analytics report HTML. |
400 | Invalid report request. |
401 | Missing, invalid, or revoked API key. |
403 | Plan does not include this analytics level. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X POST "https://app.tokportal.com/api/ext/analytics/export/reports/html" \
-H "X-API-Key: sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"title": "Launch campaign",
"template": "template",
"brandName": "brandName",
"brandAccent": "brandAccent"
}'
Node
const response = await fetch('https://app.tokportal.com/api/ext/analytics/export/reports/html', {
method: 'POST',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"title": "Launch campaign",
"template": "template",
"brandName": "brandName",
"brandAccent": "brandAccent"
})
});
const data = await response.json();
Python
response = requests.request(
'POST',
'https://app.tokportal.com/api/ext/analytics/export/reports/html',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]},
json={
"title": "Launch campaign",
"template": "template",
"brandName": "brandName",
"brandAccent": "brandAccent"
}
)
print(response.json())
Go
req, _ := http.NewRequest("POST", "https://app.tokportal.com/api/ext/analytics/export/reports/html", strings.NewReader("{\n \"title\": \"Launch campaign\",\n \"template\": \"template\",\n \"brandName\": \"brandName\",\n \"brandAccent\": \"brandAccent\"\n}"))
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
Get analytics time series
GET /analytics/series
Operation ID: getAnalyticsSeries
| Parameter | In | Required | Description |
|---|---|---|---|
metric | query | No | |
granularity | query | No | |
mode | query | No | |
account | query | No | Repeatable account filter. |
from | query | No | |
to | query | No |
| Status | Description |
|---|---|
200 | Analytics time series. |
401 | Missing, invalid, or revoked API key. |
403 | Plan does not include this analytics level. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Examples
curl
curl -X GET "https://app.tokportal.com/api/ext/analytics/series?metric=example&granularity=example" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/analytics/series?metric=example&granularity=example', {
method: 'GET',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'GET',
'https://app.tokportal.com/api/ext/analytics/series?metric=example&granularity=example',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("GET", "https://app.tokportal.com/api/ext/analytics/series?metric=example&granularity=example", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Get account analytics drilldown
GET /analytics/accounts/{id}
Operation ID: getAnalyticsAccount
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Saved account ID. |
| Status | Description |
|---|---|
200 | Account analytics drilldown. |
401 | Missing, invalid, or revoked API key. |
404 | Account not found. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Examples
curl
curl -X GET "https://app.tokportal.com/api/ext/analytics/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/analytics/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c', {
method: 'GET',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'GET',
'https://app.tokportal.com/api/ext/analytics/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("GET", "https://app.tokportal.com/api/ext/analytics/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Refresh analytics account
POST /analytics/accounts/{id}/refresh
Operation ID: refreshAnalyticsAccount
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Saved account ID. |
Request body: application/json (RefreshAnalyticsRequest)
| Status | Description |
|---|---|
200 | Refresh result. |
401 | Missing, invalid, or revoked API key. |
403 | Plan does not include this analytics level. |
404 | Account not found. |
429 | Manual refresh cooldown active. |
502 | Refresh provider failed. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X POST "https://app.tokportal.com/api/ext/analytics/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/refresh" \
-H "X-API-Key: sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"force": false,
"includePosts": false,
"includeComments": false,
"forcePosts": false
}'
Node
const response = await fetch('https://app.tokportal.com/api/ext/analytics/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/refresh', {
method: 'POST',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"force": false,
"includePosts": false,
"includeComments": false,
"forcePosts": false
})
});
const data = await response.json();
Python
response = requests.request(
'POST',
'https://app.tokportal.com/api/ext/analytics/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/refresh',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]},
json={
"force": false,
"includePosts": false,
"includeComments": false,
"forcePosts": false
}
)
print(response.json())
Go
req, _ := http.NewRequest("POST", "https://app.tokportal.com/api/ext/analytics/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/refresh", strings.NewReader("{\n \"force\": false,\n \"includePosts\": false,\n \"includeComments\": false,\n \"forcePosts\": false\n}"))
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
List raw account analytics snapshots
GET /analytics/accounts/{id}/raw
Operation ID: listAnalyticsAccountRawSnapshots
Returns owner-scoped stored raw analytics payloads for a saved account. Full analytics tier only.
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Saved account ID. |
source | query | No | |
limit | query | No | |
from | query | No | |
to | query | No |
| Status | Description |
|---|---|
200 | Raw account analytics snapshots. |
401 | Missing, invalid, or revoked API key. |
403 | Plan does not include raw analytics payloads. |
404 | Account not found. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Examples
curl
curl -X GET "https://app.tokportal.com/api/ext/analytics/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/raw?source=example&limit=example" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/analytics/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/raw?source=example&limit=example', {
method: 'GET',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'GET',
'https://app.tokportal.com/api/ext/analytics/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/raw?source=example&limit=example',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("GET", "https://app.tokportal.com/api/ext/analytics/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/raw?source=example&limit=example", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Get account analytics compatibility view
GET /accounts/{id}/analytics
Operation ID: getAccountAnalytics
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Saved account ID. |
| Status | Description |
|---|---|
200 | Account analytics data. |
401 | Missing, invalid, or revoked API key. |
404 | Account not found. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Examples
curl
curl -X GET "https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/analytics" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/analytics', {
method: 'GET',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'GET',
'https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/analytics',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("GET", "https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/analytics", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
List post analytics for an account
GET /accounts/{id}/analytics/videos
Operation ID: listAccountVideoAnalytics
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Saved account ID. |
page | query | No | Page number. |
per_page | query | No | Items per page. |
sort_by | query | No | |
sort_order | query | No |
| Status | Description |
|---|---|
200 | Post analytics list. |
401 | Missing, invalid, or revoked API key. |
404 | Account not found. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Examples
curl
curl -X GET "https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/analytics/videos?page=example&per_page=example" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/analytics/videos?page=example&per_page=example', {
method: 'GET',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'GET',
'https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/analytics/videos?page=example&per_page=example',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("GET", "https://app.tokportal.com/api/ext/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/analytics/videos?page=example&per_page=example", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Get single video analytics
GET /videos/{id}/analytics
Operation ID: getVideoAnalytics
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Video ID. |
| Status | Description |
|---|---|
200 | Video analytics. |
401 | Missing, invalid, or revoked API key. |
404 | Video not found. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Examples
curl
curl -X GET "https://app.tokportal.com/api/ext/videos/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/analytics" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/videos/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/analytics', {
method: 'GET',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'GET',
'https://app.tokportal.com/api/ext/videos/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/analytics',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("GET", "https://app.tokportal.com/api/ext/videos/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/analytics", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Get comment pulse analytics
GET /analytics/comments
Operation ID: getCommentPulse
| Parameter | In | Required | Description |
|---|---|---|---|
platform | query | No | |
country | query | No | |
account | query | No | |
post | query | No | |
limit | query | No | |
postLimit | query | No | |
from | query | No | |
to | query | No |
| Status | Description |
|---|---|
200 | Comment pulse analytics. |
401 | Missing, invalid, or revoked API key. |
403 | Plan does not include this analytics level. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Examples
curl
curl -X GET "https://app.tokportal.com/api/ext/analytics/comments?platform=example&country=example" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/analytics/comments?platform=example&country=example', {
method: 'GET',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'GET',
'https://app.tokportal.com/api/ext/analytics/comments?platform=example&country=example',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("GET", "https://app.tokportal.com/api/ext/analytics/comments?platform=example&country=example", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
List comments for an account post
GET /analytics/accounts/{id}/comments
Operation ID: listAnalyticsAccountComments
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Saved account ID. |
trackedPostId | query | No | |
postId | query | No | |
limit | query | No |
| Status | Description |
|---|---|
200 | Post comments. |
401 | Missing, invalid, or revoked API key. |
403 | Plan does not include this analytics level. |
404 | Account or post not found. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Examples
curl
curl -X GET "https://app.tokportal.com/api/ext/analytics/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/comments?trackedPostId=example&postId=example" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/analytics/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/comments?trackedPostId=example&postId=example', {
method: 'GET',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'GET',
'https://app.tokportal.com/api/ext/analytics/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/comments?trackedPostId=example&postId=example',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("GET", "https://app.tokportal.com/api/ext/analytics/accounts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/comments?trackedPostId=example&postId=example", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
List raw post analytics snapshots
GET /analytics/posts/{id}/raw
Operation ID: listAnalyticsPostRawSnapshots
Returns owner-scoped stored raw analytics payloads for a tracked post. Full analytics tier only.
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Tracked post ID. |
source | query | No | |
limit | query | No | |
from | query | No | |
to | query | No |
| Status | Description |
|---|---|
200 | Raw post analytics snapshots. |
401 | Missing, invalid, or revoked API key. |
403 | Plan does not include raw analytics payloads. |
404 | Post not found. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Examples
curl
curl -X GET "https://app.tokportal.com/api/ext/analytics/posts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/raw?source=example&limit=example" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/analytics/posts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/raw?source=example&limit=example', {
method: 'GET',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'GET',
'https://app.tokportal.com/api/ext/analytics/posts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/raw?source=example&limit=example',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("GET", "https://app.tokportal.com/api/ext/analytics/posts/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/raw?source=example&limit=example", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Webhooks
List webhook event catalog
GET /webhooks/events
Operation ID: listWebhookEvents
Returns the supported webhook event types, delivery envelope, signature scheme, and example payloads. This endpoint is public so teams can inspect webhook contracts before creating an API key.
| Status | Description |
|---|---|
200 | Supported webhook events and delivery contract. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
Examples
curl
curl -X GET "https://app.tokportal.com/api/ext/webhooks/events"
Node
const response = await fetch('https://app.tokportal.com/api/ext/webhooks/events', {
method: 'GET',
headers: {
}
});
const data = await response.json();
Python
response = requests.request(
'GET',
'https://app.tokportal.com/api/ext/webhooks/events',
headers={}
)
print(response.json())
Go
req, _ := http.NewRequest("GET", "https://app.tokportal.com/api/ext/webhooks/events", nil)
resp, err := http.DefaultClient.Do(req)
List webhook endpoints
GET /webhooks
Operation ID: listWebhookEndpoints
| Parameter | In | Required | Description |
|---|---|---|---|
page | query | No | Page number. |
per_page | query | No | Items per page. |
enabled | query | No | Filter by enabled state. |
event | query | No | Filter endpoints subscribed to an event. |
| Status | Description |
|---|---|
200 | Paginated webhook endpoint list. |
401 | Missing, invalid, or revoked API key. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Examples
curl
curl -X GET "https://app.tokportal.com/api/ext/webhooks?page=example&per_page=example" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/webhooks?page=example&per_page=example', {
method: 'GET',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'GET',
'https://app.tokportal.com/api/ext/webhooks?page=example&per_page=example',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("GET", "https://app.tokportal.com/api/ext/webhooks?page=example&per_page=example", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Create a webhook endpoint
POST /webhooks
Operation ID: createWebhookEndpoint
Creates a webhook endpoint and returns its signing secret once. Store the secret to verify TokPortal webhook signatures.
Request body: application/json (CreateWebhookEndpointRequest)
| Status | Description |
|---|---|
201 | Webhook endpoint created. |
400 | Invalid webhook endpoint. |
401 | Missing, invalid, or revoked API key. |
409 | Endpoint already exists. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X POST "https://app.tokportal.com/api/ext/webhooks" \
-H "X-API-Key: sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/resource",
"events": [
"webhook.test"
]
}'
Node
const response = await fetch('https://app.tokportal.com/api/ext/webhooks', {
method: 'POST',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"url": "https://example.com/resource",
"events": [
"webhook.test"
]
})
});
const data = await response.json();
Python
response = requests.request(
'POST',
'https://app.tokportal.com/api/ext/webhooks',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]},
json={
"url": "https://example.com/resource",
"events": [
"webhook.test"
]
}
)
print(response.json())
Go
req, _ := http.NewRequest("POST", "https://app.tokportal.com/api/ext/webhooks", strings.NewReader("{\n \"url\": \"https://example.com/resource\",\n \"events\": [\n \"webhook.test\"\n ]\n}"))
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
Get a webhook endpoint
GET /webhooks/{id}
Operation ID: getWebhookEndpoint
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Webhook endpoint ID. |
| Status | Description |
|---|---|
200 | Webhook endpoint details. |
401 | Missing, invalid, or revoked API key. |
404 | Webhook endpoint not found. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Examples
curl
curl -X GET "https://app.tokportal.com/api/ext/webhooks/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/webhooks/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c', {
method: 'GET',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'GET',
'https://app.tokportal.com/api/ext/webhooks/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("GET", "https://app.tokportal.com/api/ext/webhooks/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Update a webhook endpoint
PATCH /webhooks/{id}
Operation ID: updateWebhookEndpoint
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Webhook endpoint ID. |
Request body: application/json (UpdateWebhookEndpointRequest)
| Status | Description |
|---|---|
200 | Webhook endpoint updated. |
400 | Invalid webhook endpoint patch. |
401 | Missing, invalid, or revoked API key. |
404 | Webhook endpoint not found. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X PATCH "https://app.tokportal.com/api/ext/webhooks/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c" \
-H "X-API-Key: sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/resource",
"events": [
"webhook.test"
],
"description": "Campaign content description.",
"enabled": false
}'
Node
const response = await fetch('https://app.tokportal.com/api/ext/webhooks/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c', {
method: 'PATCH',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"url": "https://example.com/resource",
"events": [
"webhook.test"
],
"description": "Campaign content description.",
"enabled": false
})
});
const data = await response.json();
Python
response = requests.request(
'PATCH',
'https://app.tokportal.com/api/ext/webhooks/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]},
json={
"url": "https://example.com/resource",
"events": [
"webhook.test"
],
"description": "Campaign content description.",
"enabled": false
}
)
print(response.json())
Go
req, _ := http.NewRequest("PATCH", "https://app.tokportal.com/api/ext/webhooks/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c", strings.NewReader("{\n \"url\": \"https://example.com/resource\",\n \"events\": [\n \"webhook.test\"\n ],\n \"description\": \"Campaign content description.\",\n \"enabled\": false\n}"))
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
Delete a webhook endpoint
DELETE /webhooks/{id}
Operation ID: deleteWebhookEndpoint
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Webhook endpoint ID. |
| Status | Description |
|---|---|
204 | Webhook endpoint deleted. |
401 | Missing, invalid, or revoked API key. |
404 | Webhook endpoint not found. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X DELETE "https://app.tokportal.com/api/ext/webhooks/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/webhooks/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c', {
method: 'DELETE',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'DELETE',
'https://app.tokportal.com/api/ext/webhooks/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("DELETE", "https://app.tokportal.com/api/ext/webhooks/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
List webhook deliveries
GET /webhooks/{id}/deliveries
Operation ID: listWebhookDeliveries
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Webhook endpoint ID. |
page | query | No | Page number. |
per_page | query | No | Items per page. |
event_type | query | No | Filter by event type. |
success | query | No | Filter by delivery success. |
| Status | Description |
|---|---|
200 | Paginated delivery attempts for the webhook endpoint. |
401 | Missing, invalid, or revoked API key. |
404 | Webhook endpoint not found. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Examples
curl
curl -X GET "https://app.tokportal.com/api/ext/webhooks/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/deliveries?page=example&per_page=example" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/webhooks/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/deliveries?page=example&per_page=example', {
method: 'GET',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'GET',
'https://app.tokportal.com/api/ext/webhooks/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/deliveries?page=example&per_page=example',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("GET", "https://app.tokportal.com/api/ext/webhooks/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/deliveries?page=example&per_page=example", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Retry a webhook delivery
POST /webhooks/{id}/deliveries/{delivery_id}/retry
Operation ID: retryWebhookDelivery
Resends the stored webhook payload to the endpoint's current URL with a fresh TokPortal-Signature header. The event ID is preserved so receivers can keep idempotent processing.
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Webhook endpoint ID. |
delivery_id | path | Yes | Webhook delivery ID. |
| Status | Description |
|---|---|
200 | Retry delivery result. |
401 | Missing, invalid, or revoked API key. |
404 | Webhook endpoint or delivery not found. |
409 | Webhook endpoint is disabled or payload is unavailable. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X POST "https://app.tokportal.com/api/ext/webhooks/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/deliveries/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/retry" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/webhooks/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/deliveries/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/retry', {
method: 'POST',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'POST',
'https://app.tokportal.com/api/ext/webhooks/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/deliveries/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/retry',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("POST", "https://app.tokportal.com/api/ext/webhooks/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/deliveries/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/retry", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Send a test webhook
POST /webhooks/{id}/test
Operation ID: testWebhookEndpoint
Sends a signed webhook.test event to the endpoint and records the delivery result.
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Webhook endpoint ID. |
| Status | Description |
|---|---|
200 | Test delivery result. |
401 | Missing, invalid, or revoked API key. |
404 | Webhook endpoint not found. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X POST "https://app.tokportal.com/api/ext/webhooks/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/test" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/webhooks/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/test', {
method: 'POST',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'POST',
'https://app.tokportal.com/api/ext/webhooks/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/test',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("POST", "https://app.tokportal.com/api/ext/webhooks/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/test", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Uploads
Create a video upload URL
POST /upload/video
Operation ID: uploadVideo
Request body: application/json (UploadVideoRequest)
| Status | Description |
|---|---|
200 | Presigned video upload URL. |
400 | Invalid upload request. |
401 | Missing, invalid, or revoked API key. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X POST "https://app.tokportal.com/api/ext/upload/video" \
-H "X-API-Key: sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"filename": "media.mp4",
"bundle_id": "9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c"
}'
Node
const response = await fetch('https://app.tokportal.com/api/ext/upload/video', {
method: 'POST',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"filename": "media.mp4",
"bundle_id": "9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c"
})
});
const data = await response.json();
Python
response = requests.request(
'POST',
'https://app.tokportal.com/api/ext/upload/video',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]},
json={
"filename": "media.mp4",
"bundle_id": "9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c"
}
)
print(response.json())
Go
req, _ := http.NewRequest("POST", "https://app.tokportal.com/api/ext/upload/video", strings.NewReader("{\n \"filename\": \"media.mp4\",\n \"bundle_id\": \"9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c\"\n}"))
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
Upload a video file directly
POST /upload/video/direct
Operation ID: uploadVideoDirect
Uploads multipart/form-data directly through TokPortal and returns the public video URL.
Request body: multipart/form-data (multipart form)
| Status | Description |
|---|---|
200 | Uploaded video URL. |
400 | Invalid upload. |
401 | Missing, invalid, or revoked API key. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X POST "https://app.tokportal.com/api/ext/upload/video/direct" \
-H "X-API-Key: sk_your_key_here" \
-F "file=@/path/to/file"
Node
const response = await fetch('https://app.tokportal.com/api/ext/upload/video/direct', {
method: 'POST',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'POST',
'https://app.tokportal.com/api/ext/upload/video/direct',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("POST", "https://app.tokportal.com/api/ext/upload/video/direct", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Create an image upload URL
POST /upload/image
Operation ID: uploadImage
Request body: application/json (UploadImageRequest)
| Status | Description |
|---|---|
200 | Signed image upload URL. |
400 | Invalid upload request. |
401 | Missing, invalid, or revoked API key. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X POST "https://app.tokportal.com/api/ext/upload/image" \
-H "X-API-Key: sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"filename": "media.mp4",
"content_type": "video/mp4",
"bundle_id": "9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c"
}'
Node
const response = await fetch('https://app.tokportal.com/api/ext/upload/image', {
method: 'POST',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"filename": "media.mp4",
"content_type": "video/mp4",
"bundle_id": "9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c"
})
});
const data = await response.json();
Python
response = requests.request(
'POST',
'https://app.tokportal.com/api/ext/upload/image',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]},
json={
"filename": "media.mp4",
"content_type": "video/mp4",
"bundle_id": "9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c"
}
)
print(response.json())
Go
req, _ := http.NewRequest("POST", "https://app.tokportal.com/api/ext/upload/image", strings.NewReader("{\n \"filename\": \"media.mp4\",\n \"content_type\": \"video/mp4\",\n \"bundle_id\": \"9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c\"\n}"))
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
Upload an image file directly
POST /upload/image/direct
Operation ID: uploadImageDirect
Uploads multipart/form-data directly through TokPortal and returns storage details. HEIF/HEIC may be converted to JPEG.
Request body: multipart/form-data (multipart form)
| Status | Description |
|---|---|
200 | Uploaded image URL. |
400 | Invalid upload. |
401 | Missing, invalid, or revoked API key. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X POST "https://app.tokportal.com/api/ext/upload/image/direct" \
-H "X-API-Key: sk_your_key_here" \
-F "file=@/path/to/file"
Node
const response = await fetch('https://app.tokportal.com/api/ext/upload/image/direct', {
method: 'POST',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'POST',
'https://app.tokportal.com/api/ext/upload/image/direct',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("POST", "https://app.tokportal.com/api/ext/upload/image/direct", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Import an image from URL
POST /upload/image/from-url
Operation ID: uploadImageFromUrl
Fetches a public direct image URL and stores it permanently in TokPortal storage.
Request body: application/json (UploadImageFromUrlRequest)
| Status | Description |
|---|---|
200 | Stored image details. |
400 | Invalid image URL or request body. |
401 | Missing, invalid, or revoked API key. |
404 | Bundle not found. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X POST "https://app.tokportal.com/api/ext/upload/image/from-url" \
-H "X-API-Key: sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/resource",
"bundle_id": "9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c"
}'
Node
const response = await fetch('https://app.tokportal.com/api/ext/upload/image/from-url', {
method: 'POST',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"url": "https://example.com/resource",
"bundle_id": "9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c"
})
});
const data = await response.json();
Python
response = requests.request(
'POST',
'https://app.tokportal.com/api/ext/upload/image/from-url',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]},
json={
"url": "https://example.com/resource",
"bundle_id": "9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c"
}
)
print(response.json())
Go
req, _ := http.NewRequest("POST", "https://app.tokportal.com/api/ext/upload/image/from-url", strings.NewReader("{\n \"url\": \"https://example.com/resource\",\n \"bundle_id\": \"9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c\"\n}"))
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
Comments
List comment tasks
GET /comments
Operation ID: listCommentTasks
| Parameter | In | Required | Description |
|---|---|---|---|
page | query | No | Page number. |
per_page | query | No | Items per page. |
status | query | No | Filter by one status or a comma-separated list of statuses. |
saved_account_id | query | No | Filter by a user-owned saved account ID. |
| Status | Description |
|---|---|
200 | Paginated comment task list. |
401 | Missing, invalid, or revoked API key. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Examples
curl
curl -X GET "https://app.tokportal.com/api/ext/comments?page=example&per_page=example" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/comments?page=example&per_page=example', {
method: 'GET',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'GET',
'https://app.tokportal.com/api/ext/comments?page=example&per_page=example',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("GET", "https://app.tokportal.com/api/ext/comments?page=example&per_page=example", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Create comment tasks
POST /comments
Operation ID: createCommentTasks
Request body: application/json (CreateCommentTaskRequest)
| Status | Description |
|---|---|
201 | Created comment tasks. |
400 | Invalid comment task request. |
401 | Missing, invalid, or revoked API key. |
402 | Insufficient credits. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X POST "https://app.tokportal.com/api/ext/comments" \
-H "X-API-Key: sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"saved_account_id": "9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c",
"comment_text": "comment_text"
}'
Node
const response = await fetch('https://app.tokportal.com/api/ext/comments', {
method: 'POST',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"saved_account_id": "9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c",
"comment_text": "comment_text"
})
});
const data = await response.json();
Python
response = requests.request(
'POST',
'https://app.tokportal.com/api/ext/comments',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]},
json={
"saved_account_id": "9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c",
"comment_text": "comment_text"
}
)
print(response.json())
Go
req, _ := http.NewRequest("POST", "https://app.tokportal.com/api/ext/comments", strings.NewReader("{\n \"saved_account_id\": \"9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c\",\n \"comment_text\": \"comment_text\"\n}"))
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
Get a comment task
GET /comments/{id}
Operation ID: getCommentTask
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Comment task ID. |
| Status | Description |
|---|---|
200 | Comment task. |
401 | Missing, invalid, or revoked API key. |
404 | Comment task not found. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Examples
curl
curl -X GET "https://app.tokportal.com/api/ext/comments/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/comments/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c', {
method: 'GET',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'GET',
'https://app.tokportal.com/api/ext/comments/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("GET", "https://app.tokportal.com/api/ext/comments/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Delete a comment task
DELETE /comments/{id}
Operation ID: deleteCommentTask
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Comment task ID. |
| Status | Description |
|---|---|
200 | Delete result. |
401 | Missing, invalid, or revoked API key. |
404 | Comment task not found. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X DELETE "https://app.tokportal.com/api/ext/comments/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/comments/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c', {
method: 'DELETE',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'DELETE',
'https://app.tokportal.com/api/ext/comments/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("DELETE", "https://app.tokportal.com/api/ext/comments/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Approve a manually confirmed comment task
POST /comments/{id}/approve
Operation ID: approveCommentTask
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Comment task ID. |
| Status | Description |
|---|---|
200 | Approved comment task. |
401 | Missing, invalid, or revoked API key. |
404 | Comment task not found. |
409 | Comment task status cannot be approved. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X POST "https://app.tokportal.com/api/ext/comments/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/approve" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/comments/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/approve', {
method: 'POST',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'POST',
'https://app.tokportal.com/api/ext/comments/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/approve',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("POST", "https://app.tokportal.com/api/ext/comments/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/approve", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)
Dispute a manually confirmed comment task
POST /comments/{id}/dispute
Operation ID: disputeCommentTask
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Comment task ID. |
Request body: application/json (DisputeCommentRequest)
| Status | Description |
|---|---|
200 | Disputed comment task. |
400 | Invalid dispute reason. |
401 | Missing, invalid, or revoked API key. |
404 | Comment task not found. |
409 | Comment task status cannot be disputed. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Idempotent-Replayed | Present with value true when a mutating request is replayed from a completed Idempotency-Key. |
Examples
curl
curl -X POST "https://app.tokportal.com/api/ext/comments/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/dispute" \
-H "X-API-Key: sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"reason": "Please review this item."
}'
Node
const response = await fetch('https://app.tokportal.com/api/ext/comments/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/dispute', {
method: 'POST',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"reason": "Please review this item."
})
});
const data = await response.json();
Python
response = requests.request(
'POST',
'https://app.tokportal.com/api/ext/comments/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/dispute',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]},
json={
"reason": "Please review this item."
}
)
print(response.json())
Go
req, _ := http.NewRequest("POST", "https://app.tokportal.com/api/ext/comments/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/dispute", strings.NewReader("{\n \"reason\": \"Please review this item.\"\n}"))
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
List comment task verification events
GET /comments/{id}/verifications
Operation ID: listCommentTaskVerifications
| Parameter | In | Required | Description |
|---|---|---|---|
id | path | Yes | Comment task ID. |
| Status | Description |
|---|---|
200 | Verification timeline. |
401 | Missing, invalid, or revoked API key. |
404 | Comment task not found. |
Response headers
| Header | Description |
|---|---|
X-TokPortal-API-Version | Current TokPortal public API contract version. |
X-TokPortal-API-Stability | Stability channel for the public API contract. |
X-TokPortal-Request-ID | Request correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier. |
X-RateLimit-Limit | Maximum token bucket capacity for the authenticated API key. |
X-RateLimit-Remaining | Approximate requests remaining for the authenticated API key after this request. |
X-RateLimit-Reset | Unix timestamp when the token bucket is expected to be full again. |
Retry-After | Seconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses. |
Examples
curl
curl -X GET "https://app.tokportal.com/api/ext/comments/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/verifications" \
-H "X-API-Key: sk_your_key_here"
Node
const response = await fetch('https://app.tokportal.com/api/ext/comments/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/verifications', {
method: 'GET',
headers: {
'X-API-Key': process.env.TOKPORTAL_API_KEY!,
}
});
const data = await response.json();
Python
response = requests.request(
'GET',
'https://app.tokportal.com/api/ext/comments/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/verifications',
headers={"X-API-Key": os.environ["TOKPORTAL_API_KEY"]}
)
print(response.json())
Go
req, _ := http.NewRequest("GET", "https://app.tokportal.com/api/ext/comments/9f3a7b2e-1c4d-4e8f-a5b6-7d9e0f1a2b3c/verifications", nil)
req.Header.Set("X-API-Key", os.Getenv("TOKPORTAL_API_KEY"))
resp, err := http.DefaultClient.Do(req)