The Flextype Tokens API organized around Representational State Transfer (REST) for delivering tokens from Flextype to apps, websites and other. Tokens is delivered as JSON data.

Endpoints

Method Endpoint Route name Description
GET /api/v1/tokens tokens.fetch Fetch token (tokens collection).
POST /api/v1/tokens tokens.create Create token.
POST /api/v1/tokens/generate tokens.generate Generate token.
POST /api/v1/tokens/generate-hash tokens.generate-hash Generate token hash.
POST /api/v1/tokens/validate-hash tokens.validate-hash Verify token hash.
PATCH /api/v1/tokens tokens.update Update token.
DELETE /api/v1/tokens tokens.delete Delete token (tokens collection).

GET /api/v1/tokens

Fetch token (tokens collection).

Request
GET /api/v1/tokens?id=YOUR_TOKEN_ID&[options]&token=YOUR_TOKENS_TOKEN
Query
Name Description
id REQUIRED Valid Entry ID
options OPTIONAL A set of valid arguments to search and sort specific needed tokens.
token REQUIRED Valid Tokens Token.
Result

Returns an array of item objects.

Options

You can send options for the query to search items in a collection that matches the specific filter's conditions.

options is an array of valid values for filter() and find() helpers.


POST /api/v1/tokens

Create token.

Request
POST /api/v1/tokens
Body
Name Description
token REQUIRED Valid Tokens token.
access_token REQUIRED Valid Access token.
data REQUIRED Data to store for the token.
Result

Returns the token item object for the token item that was just created.

Examples

Create new token.

Request
POST /api/v1/tokens
Body
{
	"token": "f3acf199a9ac120d3bfd604e1e382456",
	"access_token": "bbc4417d171e38099bd129aeca279018",
}
Response
200 OK
{
    "token": "77406fc3cd37e700fec17e44290c0049",
    "access_token": "d80d04cec3b1025024b91f04bdff029f"
}

POST /api/v1/tokens

Generate token.

Request
POST /api/v1/tokens
Body
Name Description
token REQUIRED Valid Tokens token.
access_token REQUIRED Valid Access token.
Result

Returns the token item object for the token item that was just generated.

Examples

Generate new token.

Request
POST /api/v1/tokens
Body
{
	"token": "f3acf199a9ac120d3bfd604e1e382456",
	"access_token": "bbc4417d171e38099bd129aeca279018",
}
Response
200 OK
{
    "token": "77406fc3cd37e700fec17e44290c0049",
}

POST /api/v1/tokens

Generate token hash.

Request
POST /api/v1/tokens
Body
Name Description
token REQUIRED Valid Tokens token.
access_token REQUIRED Valid Access token.
string REQUIRED String to hash.
Result

Returns the token hash result.

Examples

Generate token hash.

Request
POST /api/v1/tokens
Body
{
	"token": "76a4c6ee27bcb62c227013c7c6157a4a",
    "access_token": "4e30ae8f70d13122ccfce002acf60d10",
    "string": "4e30ae8f70d13122ccfce002acf60d10"
}
Response
200 OK
{
    "hashed_token": "$2y$10$IEPDsON7sjQ/IOXIl6KAYOqhaSn.MuRTw4dB/dlkK4cLh0Vu0Bgw2"
}

POST /api/v1/tokens

Verify token hash.

Request
POST /api/v1/tokens
Body
Name Description
token REQUIRED Valid Tokens token.
access_token REQUIRED Valid Access token.
string REQUIRED String to verify.
hash REQUIRED Hash to verify.
Result

Returns the token hash verification result.

Examples

Verify token hash.

Request
POST /api/v1/tokens
Body
{
	"token": "760c2fd33be903d5761e11d291ea0545",
    "access_token": "96d72d79af6f3a7cbfc0cf1b19d4e811",
    "string": "4e30ae8f70d13122ccfce002acf60d10",
    "hash": "$2y$10$WPzs3RbBjQFi3HJfUgomQekXg.N1vPCXqHqL6ObVcJJdzGvwSaKnq"
}
Response
200 OK
{
    "verified": true
}

PATCH /api/v1/tokens

Update token.

Request
PATCH /api/v1/tokens
Body
Name Description
id REQUIRED Unique identifier of the token.
token REQUIRED Valid Tokens token.
access_token REQUIRED Valid Access token.
data REQUIRED Data to store for the token.
Result

Returns the token item object for the token item that was just updated.

Examples

Update token.

Request
PATCH /api/v1/tokens
Body
{
    "id": "77406fc3cd37e700fec17e44290c0049",
	"token": "77406fc3cd37e700fec17e44290c0049",
    "access_token": "d80d04cec3b1025024b91f04bdff029f",
    "data": {
        "title": "Token"
    }
}
Response
200 OK
{
    "hashed_access_token": "$2y$10$btMd2ySjFRCvqzbpZXyuteIc/F6Ka6y/rHyJaEI9pFHK5n6EqIVSK",
    "created_at": 1652702640,
    "created_by": "",
    "uuid": "d01ee01a-16e1-44fc-8100-8cad04c41e0a",
    "calls": 1,
    "limit_calls": 0,
    "state": "enabled",
    "title": "Token",
    "modified_at": 1652703057,
    "id": "77406fc3cd37e700fec17e44290c0049"
}

DELETE /api/v1/tokens

Delete token.

Request
DELETE /api/v1/tokens
Body
Name Description
id REQUIRED Unique identifier of the token.
token REQUIRED Valid Tokens token.
access_token REQUIRED Valid Access token.
Result

Returns an empty body with status 204

Examples
Request
DELETE /api/v1/tokens
Body
{
	"id": "55849b694669d8a843d571c7c5f9cb6f",
	"token": "f3acf199a9ac120d3bfd604e1e382456",
	"access_token": "bbc4417d171e38099bd129aeca279018"
}