API user documentation

  • Version 1.3.1
  • Last Modified: 09/25/2018

Before you can use the APIs you will need to create your tokens in the customer portal: https://i.thinq.com.

Login to the portal, go to the API Menu, then click on the "Tokens" submenu.

To create a token click on "Add Token" in the right upper corner.

A pop-up will appear. Select which function(s) to associate with the token.

Tokens now have a single management location in addition to granular access capabilities, enabling customers to use the same or individual tokens for each of the operations they perform.

Make sure to copy the token that you will use to authenticate the API calls. Please keep the token saved. If you suspect your token has been compromised you can always delete the token and create a new one in the customer portal.

You have to use basic HTTP authorization with "username" and the LRN/CNAM token as credentials.

GET REQUEST:

URL: https://api.thinq.com/lrn/v2/{type}/{number}?format={format}&dateformat={dateformat}

Params:
The {type} of request can be "simple" or "extended".
The {number} field must be a 10 digit DID phone number.
The output {format} can be "json", "xml", "jsonp" or "html". Defaults to "json".
The last_port_date {dateformat} in the extended lookup can be "datetime", "human", "iso" or "epoch". It defaults to "iso". A null will be returned if a date isn't available.

Auth: username: "username", password: "token".

RESPONSE: (for extended type)

{
    "lrn": "9198900000",
    "last_port_date": "2017-01-27T19:12:29+00:00",
    "lerg": {
        "npa": "919",
        "nxx": "287",
        "y": "A",
        "lata": "426",
        "ocn": "7555",
        "company": "TW TELECOM OF NC",
        "rc": "DURHAM",
        "state": "NC"
    }
}

RESPONSE: (for simple type)

{
    "lrn": "9198900000"
}

You have to use basic HTTP authorization with "username" and the LRN/CNAM token as credentials.

GET REQUEST:

URL: https://api.thinq.com/lrn/{type}/{number}?format={format}

Params:
The {type} of request can be "simple" or "extended".
The {number} field must be a 10 digit DID phone number.
The output {format} can be "json", "xml", "jsonp" or "html". Defaults to "json".

Auth: username: "username", password: "token".

RESPONSE: (for extended type)

{
    "lrn": "9198900000",
    "lerg": {
        "npa": "919",
        "nxx": "287",
        "y": "A",
        "lata": "426",
        "ocn": "7555",
        "company": "TW TELECOM OF NC",
        "rc": "DURHAM",
        "state": "NC"
    }
}

RESPONSE: (for simple type)

{
    "lrn": "9198900000"
}

You'll need to be logged in as a user with permissions. You can use the token generated on the login process or create a new one. The output format can be "json", "xml", "jsonp" or "html". You have to use basic HTTP authorization with "username" and the token as credentials.

GET REQUEST:

URL: https://api.thinq.com/cnam/{number}?format={format}

The {number} field must be a 10 digit DID phone.

Params: No params.

Auth:username: "username", password: "token".

Response:

{ "cnam": "Durham NC" }
User Creation:

Command line:

curl -X POST \
-H 'Content-Type: application/json' \
-u username:password \
-d '{"user":{"username":"testuser2", "password":"1234", "first_name":"john", "last_name":"smith", "email":"johnsmith@thinq.com", "phone1":"123456", "account_id":"10", "time_zone":"-4", "skype_username":"john.smith"}}' \
https://api.thinq.com/user

Errors:

{"code":412, "message":{"description":"Username alredy exists", "detail":{"username":"testuser2"}}}

{"code":401, "message":{"description":"Unathorized", "detail":[]}}
User Login:

Command line:

curl -X POST \
-H 'Content-Type: application/json' \
-d '{"username":"testuser2","password":"1234","captcha":"gicd"}' \
https://api.thinq.com/login

Errors:

{"code":401, "message":"Wrong captcha code", "description":""}

{"code":401, "message":{"description":"Invalid username\/password combination", "detail":{"ip":"10.212.134.207", "username":"testuser2"}}}
LRN (version 2) Simple:

Command line:

curl -i -X GET \
-H "Content-Type:application/json" \
-u username:token \
https://api.thinq.com/lrn/v2/simple/9194841422?format=json
LRN (version 2) Extended:

Command line:

curl -i -X GET \
-H "Content-Type:application/json" \
-u username:token \
https://api.thinq.com/lrn/v2/extended/9194841422?format=json
LRN (version 1) Simple:

Command line:

curl -i -X GET \
-H "Content-Type:application/json" \
-u username:token \
https://api.thinq.com/lrn/simple/9194841422?format=json
LRN (version 1) Extended:

Command line:

curl -i -X GET \
-H "Content-Type:application/json" \
-u username:token \
https://api.thinq.com/lrn/extended/9194841422?format=json
CNAM:

Command line:

curl -i -X GET \
-H "Content-Type:application/json" \
-u username:password \
https://api.thinq.com/cnam/9194841422?format=json

Errors:

{"code":401,"message":{"description":"Unathorized","detail":[]}}

{"code":403,"message":{"description":"Forbidden. Username or password error.","detail":[]}}

{"code":404,"message":{"description":"'CNAM not found'.","detail":[]}}

{"code":412,"message":{"description":"Your balance is too low to perform this lookup","detail":[]}}

{"code":412,"message":{"description":"Your account does not own this product or it's not enabled","detail":[]}}