Tokens

Tokens are one time access grants that are tied to specific pages and user agents. The token system allows authenticated access to retrieving content, with a one time use model to ensure security.

SDKs

The SDK handles token generation automatically when making API requests. Consequently, there is no documentation on generating tokens within the SDK.


POSThttps://gateway.tollbit.com/dev/v2/tokens/content

Generate Content Token

This endpoint allows you to manually generate a valid token for sanctioned, paid access to a specific page, with the terms of the license type or cuid that you include in the request payload.

Required header

  • Name
    TollbitKey
    Type
    string
    Description

    Your API key which can be found in the access page of the dashboard.

Required attributes

  • Name
    url
    Type
    string
    Description

    The specific page url for the intended content to acess.

  • Name
    userAgent
    Type
    string
    Description

    Unique AgentID string for who is allowed to access the page. Make sure to use the AgentID that you will use within your application. You must use a user agent you registered in the developer portal.

  • Name
    maxPriceMicros
    Type
    int64
    Description

    The maximum price, in micro units, that you are willing to pay for this piece of content. Leaving this unset will default the field to 0, which will only allow you to retrieve free content.

  • Name
    currency
    Type
    string
    Description

    The three letter currency code. Only USD is supported at the moment. You can set a max price limit on the content you want to fetch ($1 = 1,000,000).

  • Name
    licenseType
    Type
    string
    Description

    The type of license that you are requesting the data with. Currently supports ON_DEMAND_LICENSE, ON_DEMAND_FULL_USE_LICENSE, and CUSTOM_LICENSE.

  • Name
    licenseCuid
    Type
    string (optional)
    Description

    This is only required for CUSTOM_LICENSE types.

Response

  • Name
    token
    Type
    string
    Description

    The JWT token that can be used to make a content request.

Request

POST
/dev/v2/tokens/content
curl https://gateway.tollbit.com/dev/v2/tokens/content \
  -H "Content-Type: application/json" \
  -H "TollbitKey: YOUR_API_KEY_HERE" \
  -d '{"url": "<content_url>", "userAgent": <user_agent>, "maxPriceMicros": 11000000, "currency": "USD", "licenseType": "ON_DEMAND_LICENSE"}'

Response

{
    "token": "eyJhbGciOiJFUzI1..."
}

POSThttps://gateway.tollbit.com/dev/v2/tokens/crawl

Generate Indexing Token

This endpoint allows you to manually generate a valid token for a specific page for your user agent to fetch content for indexing purposes. Note that while you may be able to generate the token, the data provider has controls to allow or disallow access through this method of fetching content.

Required header

  • Name
    TollbitKey
    Type
    string
    Description

    Your API key which can be found in the access page of the dashboard.

Required attributes

  • Name
    url
    Type
    string
    Description

    The specific page url for the intended content to acess.

  • Name
    userAgent
    Type
    string
    Description

    Unique AgentID string for who is allowed to access the page. Make sure to use the AgentID that you will use within your application. You must use a user agent you registered in the developer portal.

Response

  • Name
    token
    Type
    string
    Description

    The JWT token that can be used to make a content request.

Request

POST
/dev/v2/tokens/content
curl https://gateway.tollbit.com/dev/v2/tokens/crawl \
  -H "Content-Type: application/json" \
  -H "TollbitKey: YOUR_API_KEY_HERE" \
  -d '{"url": "<content_url>", "userAgent": <user_agent>}'

Response

{
    "token": "eyJhbGciOiJFUzI1..."
}

Was this page helpful?