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/v1/token

Generate Token

This endoint allows you to manually generate a valid token for a specific page and AgentID. Tokens are also locally generated using the SDKs. Only use the token generation endpoint for testing purposes. For any production usecases, please generate tokens locally.

Required attributes

  • Name
    orgCuid
    Type
    string
    Description

    Account identifier that can be found in the access page of the dashboard.

  • Name
    key
    Type
    string
    Description

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

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

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

  • Name
    licenseType
    Type
    string
    Description

    The type of license that you are requesting the data with. Currently only supports ON_DEMAND_LICENSE.

Request

POST
/dev/v1/token
import Tollbit from 'tollbit-sdk'

const client = new Tollbit(SECRET_KEY, ORGANIZATION_ID, USER_AGENT)

const response = await client.generateToken({
    url: "https://joshmayer.net/posts/bix",
    maxPriceMicros: 11000000,
    currency: "USD",
    licenseType: "ON_DEMAND_LICENSE",
})

Response

"8d6e547bfabedaff7db4b55594eda7d6dd45d733be570d75b4ca078464a9cc0a82f424b85c11b22b0275746b0f6737a3db93f08922279d447a106e9e10361da6dd17ed226d62666a3da104914a749064ec61cf9309bcb57f9cea1cd354ab5bd355db2cb49553ccabf94abcaa2cbe3388ca555a9458f6d6b501ddd1952ed7226a9e926d4fa429ca32b36acfcb234615cf7a09a1cbafdb11f145e9d583f35dd38148e4286c0e3bae72740ac28cd2ea307d656a282e0c8683598e76ccdfe2b30a465b5571ea5739218d00138b6190e111c55ec3a02704c88d8d7f0a7aa3df60d27cba7e9d9ff755077324f974d3ef40d46dff2610ca2a5f87f1e2cbbe0416d8"

Was this page helpful?