Tokens

Tokens are one time access grants that are tied to specific pages and AgentIDs. The token system allows easily scalable access, with highly detailed access logs of the content, so you know exactly what content you're accessing and when.

The token model

Detailed view of the fields in a token response.

Properties

  • 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.

  • Name
    token
    Type
    string
    Description

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


POST/dev/v2/tokens/content

Generate Token

This endoint allows you to manually generate a valid token for a specific page and AgentID.

You can create a token by using our convenient token generation endpoint POST https://gateway.tollbit.com/tollbit/dev/v2/tokens/content with the token as the JSON body of the POST request. The endpoint requires "TollbitKey" to be passed in the header.

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 only supports ON_DEMAND_LICENSE.

  • Name
    licenseCuid
    Type
    string (optional)
    Description

    This is only required for CUSTOM_LICENSE types.

  • Name
    format
    Type
    string
    Description

    What the data is returned as, can be markdown or html.

Request

POST
/dev/v2/tokens/content
curl https://api.tollbit.com/dev/v2/tokens/content \
  -H "Content-Type: application/json" \
  -H "TollbitKey: YOUR_API_KEY_HERE" \
  -d '{"url": "https://www.pioneervalleygazette.com/daydream", "userAgent": <user_agent>, "maxPriceMicros": 11000000, "currency": "USD", "licenseType": "ON_DEMAND_LICENSE", "licenseCuid": "..." // only required for CUSTOM_LICENSE types, "format": "HTML"}'

Response

"8d6e547bfabedaff7db4b55594eda7d6dd45d733be570d75b4ca078464a9cc0a82f424b85c11b22b0275746b0f6737a3db93f08922279d447a106e9e10361da6dd17ed226d62666a3da104914a749064ec61cf9309bcb57f9cea1cd354ab5bd355db2cb49553ccabf94abcaa2cbe3388ca555a9458f6d6b501ddd1952ed7226a9e926d4fa429ca32b36acfcb234615cf7a09a1cbafdb11f145e9d583f35dd38148e4286c0e3bae72740ac28cd2ea307d656a282e0c8683598e76ccdfe2b30a465b5571ea5739218d00138b6190e111c55ec3a02704c88d8d7f0a7aa3df60d27cba7e9d9ff755077324f974d3ef40d46dff2610ca2a5f87f1e2cbbe0416d8"

Was this page helpful?