NAV Navbar
HTTP

Introduction

Welcome to the Blyng Admin API! You can use this to get blyng internal tokens & client tokens. You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.

Authentication

Blyng Token Generation

Get /api/v1/admin/blyng_token

Creates token to pass to all clients.

Response Body json { "blyng_token": "<token>", "blyng_refreshToken": "<refresh token>", }

Example: Response Body

{
  "blyng_token": "tyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYWdlSUQiOiIxNzI5NTgwNTgwNDc5NTU2IiwiaWF0IjoxNTUyNDU2MjExLCJleHAiOjE1NTI0NTk4MTF9.xAfZquhUfg8h--0U",
  "blyng_refreshToken": "JhbGciOiJIUsdfsfiIsInR5cCI6IkpXVCJ9.eYWdlSUQiOiIxNzI5NTgwNTgwNDc5NTU2IiwiaWF0IjoxNTUyNDU2MjEI0NTk4MTF9.xAfZqu"
}

With endpoint /api/v1/admin/blyng_token you get blyng internal token to pass on to clients which the can use to get client tokens.

HTTP Request

POST https://api.blyng.io/api/v1/admin/blyng_token

Token Validity

Parameter Validity
blyng_token 30 days from the time of generation
blyng_refreshToken 40 days from the time of generation

Blyng Refresh Token Generation

POST /api/v1/admin/blyng_refreshToken

Refreshses blyng refresh token & blyng token

Post Body json { "blyng_token": "<token generated from api/v1/admin/blyng_token endpoint>", "blyng_refreshToken": "<refresh token generated from api/v1/admin/blyng_token endpoint>" }

Example: Post Body json { "blyng_token": "tyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYWdlSUQiOiIxNzI5NTgwNTgwNDc5NTU2IiwiaWF0IjoxNTUyNDU2MjExLCJleHAiOjE1NTI0NTk4MTF9.xAfZquhUfg8h--0U", "blyng_refreshToken": "JhbGciOiJIUsdfsfiIsInR5cCI6IkpXVCJ9.eYWdlSUQiOiIxNzI5NTgwNTgwNDc5NTU2IiwiaWF0IjoxNTUyNDU2MjEI0NTk4MTF9.xAfZqu" }

Response Body ```json {
"blyng_token": "", "blyng_refreshToken": ""

} ```

Example: Response Body json { "blyng_token": "tyJhbadiOiJIUzI145IsInR5cCI6IkpXVCJ9.sfdyJpYXQisdfsfjE1NTI1NDY0NDksImV4cCI6MTU1NTEzODQ0OX0", "blyng_refreshToken": "asdabGciOiJIUsdfsfiIsInR5cCI6IkpXVCJ9.eYWdlSUQiOiIxNzI5NTgwNTgwNDc5NTU2IiwiaWF0IjoxNTUyNDU2MjEI0NTk4MTF9.xe13es" }

With endpoint /api/v1/admin/blyng_refreshToken new blyng refresh token & blyng token are received.

HTTP Request

POST https://api.blyng.io/api/v1/admin/blyng_refreshToken

Token Validity

Parameter Validity
blyng_token 30 days from the time of generation
blyng_refreshToken 40 days from the time of generation

Client Token Generation

POST /api/v1/admin/token

Creates token for the given pageId.

Post Body json { "blyng_token": "<Blyng Internal Token>", "pageID": "<Client page id>" }

Example: Post Body json { "blyng_token": "<blyng token>", "pageID":"1729580580479556" }

Response Body json { "token": "<token to use for client>", "refreshToken": "<refresh token to use for client>", }

Example: Response Body json { "token": "tyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYWdlSUQiOiIxNzI5NTgwNTgwNDc5NTU2IiwiaWF0IjoxNTUyNDU2MjExLCJleHAiOjE1NTI0NTk4MTF9.xAfZquhUfg8h--0U", "refreshToken": "JhbGciOiJIUsdfsfiIsInR5cCI6IkpXVCJ9.eYWdlSUQiOiIxNzI5NTgwNTgwNDc5NTU2IiwiaWF0IjoxNTUyNDU2MjEI0NTk4MTF9.xAfZqu" }

With endpoint /api/v1/admin/token the client can get access token and refresh token by sending blyng internal token and client page id, the access token gives access to all api/v1/client endpoints.

HTTP Request

POST https://api.blyng.io/api/v1/admin/token

Query Parameters

Parameter Default Description
blyng_token N/A Access token provided by blyng
pageID N/A Client's page id

Token Validity

Parameter Validity
token 10 days from the time of generation
refreshToken 15 days from the time of generation

Errors

The Kittn API uses the following error codes:

Error Code Meaning
400 Bad Request -- Your request is invalid.
401 Unauthorized -- Your API key is wrong.
403 Forbidden -- The kitten requested is hidden for administrators only.
404 Not Found -- The specified kitten could not be found.
405 Method Not Allowed -- You tried to access a kitten with an invalid method.
406 Not Acceptable -- You requested a format that isn't json.
410 Gone -- The kitten requested has been removed from our servers.
418 I'm a teapot.
429 Too Many Requests -- You're requesting too many kittens! Slow down!
500 Internal Server Error -- We had a problem with our server. Try again later.
503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.