API Reference

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

StatusDescription
200Authenticated user profile and credit balance.
401Missing, invalid, or revoked API key.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds 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)

StatusDescription
200Updated safe workspace settings.
400Invalid workspace setting.
401Missing, invalid, or revoked API key.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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

StatusDescription
200Enabled country codes available for account creation.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest 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

StatusDescription
200Supported social platforms.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest 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

StatusDescription
200Current credit cost table.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest 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

StatusDescription
200Current credit balance.
401Missing, invalid, or revoked API key.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds 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

ParameterInRequiredDescription
pagequeryNoPage number.
per_pagequeryNoItems per page.
date_fromqueryNoFilter transactions created on or after this date.
date_toqueryNoFilter transactions created before the day after this date.
StatusDescription
200Paginated credit transaction history.
401Missing, invalid, or revoked API key.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds 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

ParameterInRequiredDescription
pagequeryNoPage number.
per_pagequeryNoItems per page.
statusqueryNoFilter by bundle status.
bundle_typequeryNo
platformqueryNo
external_refqueryNo
account_statusqueryNo
StatusDescription
200Paginated bundle list.
401Missing, invalid, or revoked API key.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds 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)

StatusDescription
201Bundle created.
400Invalid request body or business rule violation.
401Missing, invalid, or revoked API key.
402Insufficient credits.
409Duplicate or invalid state.
429Create rate limit exceeded.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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)

StatusDescription
201Bulk bundle creation result.
400Invalid request body or business rule violation.
401Missing, invalid, or revoked API key.
402Insufficient credits.
429Create rate limit exceeded.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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

ParameterInRequiredDescription
idpathYesBundle ID.
StatusDescription
200Bundle details.
401Missing, invalid, or revoked API key.
404Bundle not found.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds 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.

ParameterInRequiredDescription
idpathYesBundle ID.

Request body: application/json (PatchBundleRequest)

StatusDescription
200Bundle updated.
400Invalid patch body.
401Missing, invalid, or revoked API key.
403Bundle belongs to another account.
404Bundle not found.
409Duplicate external_ref.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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

ParameterInRequiredDescription
idpathYesBundle ID.
StatusDescription
200Publish result.
401Missing, invalid, or revoked API key.
402Insufficient credits.
404Bundle not found.
409Bundle is not ready or is in an invalid state.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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

ParameterInRequiredDescription
idpathYesBundle ID.
StatusDescription
200Readiness blockers and ready flag.
401Missing, invalid, or revoked API key.
404Bundle not found.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds 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

ParameterInRequiredDescription
idpathYesBundle ID.
StatusDescription
200Unpublish result.
401Missing, invalid, or revoked API key.
404Bundle not found.
409Bundle is in an invalid state.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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

ParameterInRequiredDescription
idpathYesBundle ID.

Request body: application/json (QuantityRequest)

StatusDescription
200Created video slots.
400Invalid quantity or bundle type.
401Missing, invalid, or revoked API key.
402Insufficient credits.
404Bundle not found.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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

ParameterInRequiredDescription
idpathYesBundle ID.

Request body: application/json (QuantityRequest)

StatusDescription
200Created edit slots.
400Invalid quantity.
401Missing, invalid, or revoked API key.
402Insufficient credits.
404Bundle not found.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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

ParameterInRequiredDescription
idpathYesBundle ID.
StatusDescription
200Account configuration.
401Missing, invalid, or revoked API key.
404Bundle or account not found.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds 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

ParameterInRequiredDescription
idpathYesBundle ID.

Request body: application/json (ConfigureAccountRequest)

StatusDescription
200Configured account.
400Invalid account profile.
401Missing, invalid, or revoked API key.
404Bundle or account not found.
409Account status does not allow configuration.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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.

ParameterInRequiredDescription
idpathYesBundle ID.

Request body: application/json (AccountCorrectionsRequest)

StatusDescription
200Account corrections requested.
400Invalid correction body.
401Missing, invalid, or revoked API key.
404Bundle or account not found.
409Account is not in review.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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.

ParameterInRequiredDescription
idpathYesBundle ID.
StatusDescription
200Account finalized.
401Missing, invalid, or revoked API key.
404Bundle or account not found.
409Account is not in review.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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

ParameterInRequiredDescription
idpathYesBundle ID.
StatusDescription
200Video slots for the bundle.
401Missing, invalid, or revoked API key.
404Bundle not found.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds 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

ParameterInRequiredDescription
idpathYesBundle ID.
positionpathYes1-based video slot position.
StatusDescription
200Video slot configuration.
401Missing, invalid, or revoked API key.
404Bundle or video slot not found.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds 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.

ParameterInRequiredDescription
idpathYesBundle ID.
positionpathYes1-based video slot position.

Request body: application/json (ConfigureVideoRequest)

StatusDescription
200Configured video slot.
400Invalid video metadata.
401Missing, invalid, or revoked API key.
404Bundle or video slot not found.
409Video status does not allow configuration.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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

ParameterInRequiredDescription
idpathYesBundle ID.
positionpathYes1-based video slot position.

Request body: application/json (PatchVideoRequest)

StatusDescription
200Patched video slot.
400Invalid patch body.
401Missing, invalid, or revoked API key.
404Bundle or video slot not found.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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

ParameterInRequiredDescription
idpathYesBundle ID.

Request body: application/json (BatchConfigureVideosRequest)

StatusDescription
200Batch video configuration result.
400Invalid batch body.
401Missing, invalid, or revoked API key.
404Bundle not found.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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

ParameterInRequiredDescription
idpathYesBundle ID.
StatusDescription
200Published video slots.
401Missing, invalid, or revoked API key.
404Bundle not found.
409Bundle status does not allow publishing videos.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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.

ParameterInRequiredDescription
idpathYesBundle ID.

Request body: multipart/form-data (multipart form)

StatusDescription
200CSV import result.
400Invalid CSV or upload body.
401Missing, invalid, or revoked API key.
404Bundle not found.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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

ParameterInRequiredDescription
idpathYesBundle ID.
positionpathYes1-based video slot position.
StatusDescription
200Video slot published.
401Missing, invalid, or revoked API key.
404Bundle or video slot not found.
409Bundle or video status does not allow publishing.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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

ParameterInRequiredDescription
idpathYesBundle ID.
positionpathYes1-based video slot position.
StatusDescription
200Video slot reset.
401Missing, invalid, or revoked API key.
404Bundle or video slot not found.
409Video status does not allow reset.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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

ParameterInRequiredDescription
idpathYesBundle ID.
positionpathYes1-based video slot position.
StatusDescription
200Video slot unscheduled.
401Missing, invalid, or revoked API key.
404Bundle or video slot not found.
409Video status does not allow unscheduling.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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

ParameterInRequiredDescription
idpathYesBundle ID.
positionpathYes1-based video slot position.
StatusDescription
200Video slot finalized.
401Missing, invalid, or revoked API key.
404Bundle or video slot not found.
409Video is not in review.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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

ParameterInRequiredDescription
idpathYesBundle ID.
positionpathYes1-based video slot position.

Request body: application/json (VideoCorrectionsRequest)

StatusDescription
200Video corrections requested.
400Invalid correction body.
401Missing, invalid, or revoked API key.
404Bundle or video slot not found.
409Video is not in review.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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.

ParameterInRequiredDescription
idpathYesBundle ID.
positionpathYes1-based video slot position.

Request body: application/json (FixVideoDownloadRequest)

StatusDescription
200Video download issue fixed.
400Invalid replacement media body.
401Missing, invalid, or revoked API key.
404Bundle or video slot not found.
409Video does not have a download issue.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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.

ParameterInRequiredDescription
idpathYesVideo ID.

Request body: application/json (AdCodeRequest)

StatusDescription
201Ad code request created.
400Invalid request, no assigned manager, or platform not available.
401Missing, invalid, or revoked API key.
402Insufficient credits.
404Video not found.
409Video not finalized or an open request already exists.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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).

ParameterInRequiredDescription
idpathYesVideo ID.
StatusDescription
200Latest ad code request (or null).
401Missing, invalid, or revoked API key.
404Video not found.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds 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

ParameterInRequiredDescription
pagequeryNoPage number.
per_pagequeryNoItems per page.
platformqueryNoFilter by platform.
countryqueryNoFilter by country code or country alias.
StatusDescription
200Paginated delivered account list.
401Missing, invalid, or revoked API key.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds 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

ParameterInRequiredDescription
idpathYesSaved account ID.
StatusDescription
200Delivered account details.
401Missing, invalid, or revoked API key.
404Account not found.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds 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.

ParameterInRequiredDescription
idpathYesSaved account ID.

Request body: application/json (UpdateAccountCommentingProfileRequest)

StatusDescription
200Updated account commenting profile.
400Invalid commenting profile body.
401Missing, invalid, or revoked API key.
404Account not found.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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

ParameterInRequiredDescription
idpathYesSaved account ID.
pagequeryNoPage number.
per_pagequeryNoItems per page.
statusqueryNoFilter by bundle status.
StatusDescription
200Paginated bundles for account.
401Missing, invalid, or revoked API key.
404Account not found.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds 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.

ParameterInRequiredDescription
idpathYesSaved account ID.

Request body: application/json (AcknowledgeSupportForfeitRequest)

StatusDescription
200Verification code result.
401Missing, invalid, or revoked API key.
402Owning fee required.
404Account or verification code not found.
428Support-forfeit acknowledgment required. Retry with {"acknowledge_support_forfeit": true} after confirming the disclaimer.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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.

ParameterInRequiredDescription
idpathYesSaved account ID.

Request body: application/json (AcknowledgeSupportForfeitRequest)

StatusDescription
200Credentials reveal result.
401Missing, invalid, or revoked API key.
402Owning fee required.
404Account not found.
428Support-forfeit acknowledgment required. Retry with {"acknowledge_support_forfeit": true} after confirming the disclaimer.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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

ParameterInRequiredDescription
idpathYesSaved account ID.
StatusDescription
200Active edit request.
401Missing, invalid, or revoked API key.
404Account not found.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds 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

ParameterInRequiredDescription
idpathYesSaved account ID.

Request body: application/json (AccountEditRequest)

StatusDescription
201Edit request created.
400Invalid edit request.
401Missing, invalid, or revoked API key.
404Account not found.
409An active edit request already exists.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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

ParameterInRequiredDescription
idpathYesSaved account ID.
StatusDescription
200Manual refresh availability.
401Missing, invalid, or revoked API key.
404Account not found.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds 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.

ParameterInRequiredDescription
idpathYesSaved account ID.

Request body: application/json (RefreshAnalyticsRequest)

StatusDescription
200Refresh result.
401Missing, invalid, or revoked API key.
403Plan does not include this analytics level.
404Account not found.
429Manual refresh cooldown active.
502Refresh provider failed.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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

ParameterInRequiredDescription
workspacequeryNo
platformqueryNoRepeatable platform filter.
countryqueryNoRepeatable country filter.
accountqueryNoRepeatable account filter.
fromqueryNo
toqueryNo
StatusDescription
200Analytics dashboard data.
401Missing, invalid, or revoked API key.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds 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.

StatusDescription
200Analytics contract and access payload.
401Missing, invalid, or revoked API key.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds 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

ParameterInRequiredDescription
accountqueryNoRepeatable account filter.
workspacequeryNo
platformqueryNoRepeatable platform filter.
countryqueryNoRepeatable country filter.
qqueryNoSearch query.
fromqueryNo
toqueryNo
StatusDescription
200CSV export of analytics video rows.
401Missing, invalid, or revoked API key.
403Plan does not include this analytics level.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds 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)

StatusDescription
200Created analytics report.
400Invalid report request.
401Missing, invalid, or revoked API key.
403Plan does not include this analytics level.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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)

StatusDescription
200Standalone analytics report HTML.
400Invalid report request.
401Missing, invalid, or revoked API key.
403Plan does not include this analytics level.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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

ParameterInRequiredDescription
metricqueryNo
granularityqueryNo
modequeryNo
accountqueryNoRepeatable account filter.
fromqueryNo
toqueryNo
StatusDescription
200Analytics time series.
401Missing, invalid, or revoked API key.
403Plan does not include this analytics level.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds 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

ParameterInRequiredDescription
idpathYesSaved account ID.
StatusDescription
200Account analytics drilldown.
401Missing, invalid, or revoked API key.
404Account not found.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds 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

ParameterInRequiredDescription
idpathYesSaved account ID.

Request body: application/json (RefreshAnalyticsRequest)

StatusDescription
200Refresh result.
401Missing, invalid, or revoked API key.
403Plan does not include this analytics level.
404Account not found.
429Manual refresh cooldown active.
502Refresh provider failed.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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.

ParameterInRequiredDescription
idpathYesSaved account ID.
sourcequeryNo
limitqueryNo
fromqueryNo
toqueryNo
StatusDescription
200Raw account analytics snapshots.
401Missing, invalid, or revoked API key.
403Plan does not include raw analytics payloads.
404Account not found.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds 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

ParameterInRequiredDescription
idpathYesSaved account ID.
StatusDescription
200Account analytics data.
401Missing, invalid, or revoked API key.
404Account not found.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds 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

ParameterInRequiredDescription
idpathYesSaved account ID.
pagequeryNoPage number.
per_pagequeryNoItems per page.
sort_byqueryNo
sort_orderqueryNo
StatusDescription
200Post analytics list.
401Missing, invalid, or revoked API key.
404Account not found.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds 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

ParameterInRequiredDescription
idpathYesVideo ID.
StatusDescription
200Video analytics.
401Missing, invalid, or revoked API key.
404Video not found.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds 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

ParameterInRequiredDescription
platformqueryNo
countryqueryNo
accountqueryNo
postqueryNo
limitqueryNo
postLimitqueryNo
fromqueryNo
toqueryNo
StatusDescription
200Comment pulse analytics.
401Missing, invalid, or revoked API key.
403Plan does not include this analytics level.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds 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

ParameterInRequiredDescription
idpathYesSaved account ID.
trackedPostIdqueryNo
postIdqueryNo
limitqueryNo
StatusDescription
200Post comments.
401Missing, invalid, or revoked API key.
403Plan does not include this analytics level.
404Account or post not found.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds 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.

ParameterInRequiredDescription
idpathYesTracked post ID.
sourcequeryNo
limitqueryNo
fromqueryNo
toqueryNo
StatusDescription
200Raw post analytics snapshots.
401Missing, invalid, or revoked API key.
403Plan does not include raw analytics payloads.
404Post not found.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds 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.

StatusDescription
200Supported webhook events and delivery contract.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest 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

ParameterInRequiredDescription
pagequeryNoPage number.
per_pagequeryNoItems per page.
enabledqueryNoFilter by enabled state.
eventqueryNoFilter endpoints subscribed to an event.
StatusDescription
200Paginated webhook endpoint list.
401Missing, invalid, or revoked API key.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds 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)

StatusDescription
201Webhook endpoint created.
400Invalid webhook endpoint.
401Missing, invalid, or revoked API key.
409Endpoint already exists.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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

ParameterInRequiredDescription
idpathYesWebhook endpoint ID.
StatusDescription
200Webhook endpoint details.
401Missing, invalid, or revoked API key.
404Webhook endpoint not found.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds 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

ParameterInRequiredDescription
idpathYesWebhook endpoint ID.

Request body: application/json (UpdateWebhookEndpointRequest)

StatusDescription
200Webhook endpoint updated.
400Invalid webhook endpoint patch.
401Missing, invalid, or revoked API key.
404Webhook endpoint not found.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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

ParameterInRequiredDescription
idpathYesWebhook endpoint ID.
StatusDescription
204Webhook endpoint deleted.
401Missing, invalid, or revoked API key.
404Webhook endpoint not found.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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

ParameterInRequiredDescription
idpathYesWebhook endpoint ID.
pagequeryNoPage number.
per_pagequeryNoItems per page.
event_typequeryNoFilter by event type.
successqueryNoFilter by delivery success.
StatusDescription
200Paginated delivery attempts for the webhook endpoint.
401Missing, invalid, or revoked API key.
404Webhook endpoint not found.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds 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.

ParameterInRequiredDescription
idpathYesWebhook endpoint ID.
delivery_idpathYesWebhook delivery ID.
StatusDescription
200Retry delivery result.
401Missing, invalid, or revoked API key.
404Webhook endpoint or delivery not found.
409Webhook endpoint is disabled or payload is unavailable.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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.

ParameterInRequiredDescription
idpathYesWebhook endpoint ID.
StatusDescription
200Test delivery result.
401Missing, invalid, or revoked API key.
404Webhook endpoint not found.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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)

StatusDescription
200Presigned video upload URL.
400Invalid upload request.
401Missing, invalid, or revoked API key.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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)

StatusDescription
200Uploaded video URL.
400Invalid upload.
401Missing, invalid, or revoked API key.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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)

StatusDescription
200Signed image upload URL.
400Invalid upload request.
401Missing, invalid, or revoked API key.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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)

StatusDescription
200Uploaded image URL.
400Invalid upload.
401Missing, invalid, or revoked API key.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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)

StatusDescription
200Stored image details.
400Invalid image URL or request body.
401Missing, invalid, or revoked API key.
404Bundle not found.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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

ParameterInRequiredDescription
pagequeryNoPage number.
per_pagequeryNoItems per page.
statusqueryNoFilter by one status or a comma-separated list of statuses.
saved_account_idqueryNoFilter by a user-owned saved account ID.
StatusDescription
200Paginated comment task list.
401Missing, invalid, or revoked API key.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds 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)

StatusDescription
201Created comment tasks.
400Invalid comment task request.
401Missing, invalid, or revoked API key.
402Insufficient credits.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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

ParameterInRequiredDescription
idpathYesComment task ID.
StatusDescription
200Comment task.
401Missing, invalid, or revoked API key.
404Comment task not found.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds 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

ParameterInRequiredDescription
idpathYesComment task ID.
StatusDescription
200Delete result.
401Missing, invalid, or revoked API key.
404Comment task not found.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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

ParameterInRequiredDescription
idpathYesComment task ID.
StatusDescription
200Approved comment task.
401Missing, invalid, or revoked API key.
404Comment task not found.
409Comment task status cannot be approved.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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

ParameterInRequiredDescription
idpathYesComment task ID.

Request body: application/json (DisputeCommentRequest)

StatusDescription
200Disputed comment task.
400Invalid dispute reason.
401Missing, invalid, or revoked API key.
404Comment task not found.
409Comment task status cannot be disputed.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds to wait before retrying after RATE_LIMIT_EXCEEDED. Present on 429 responses.
Idempotent-ReplayedPresent 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

ParameterInRequiredDescription
idpathYesComment task ID.
StatusDescription
200Verification timeline.
401Missing, invalid, or revoked API key.
404Comment task not found.

Response headers

HeaderDescription
X-TokPortal-API-VersionCurrent TokPortal public API contract version.
X-TokPortal-API-StabilityStability channel for the public API contract.
X-TokPortal-Request-IDRequest correlation ID. Echoes a valid X-Request-ID request header or uses a generated req_ identifier.
X-RateLimit-LimitMaximum token bucket capacity for the authenticated API key.
X-RateLimit-RemainingApproximate requests remaining for the authenticated API key after this request.
X-RateLimit-ResetUnix timestamp when the token bucket is expected to be full again.
Retry-AfterSeconds 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)