Authentication

Learn how easy it is to authenticate an API requests with the Blockdaemon Tokenization API.

To use the Tokenization API, you must authenticate your requests with your Blockdeamon API Suite key. Here's how to do it.

1. Getting an API Key

You need an API key to start using the Blockdeamon API Suite. If you don't have one, you can get a free one by signing up for Blockdaemon. Once you have an API key, you can authenticate your requests.

Need a Free API key?

Enjoy Rapid, Scalable, Multi-Protocol Blockchain Access with Ubiquity.

2. Using Your API Key

Once you have your API key, you can authenticate your requests. Overall, three different methods exist to authenticate Blockdeamon API requests. Let's have a look at each below.

2.1. Using Your API Key as a Query Parameter

The easiest way to authenticate a Blockdeamon API Suite request is via a special query parameter:

  • parameter: apiKey
  • value: YOUR_API_KEY

At the end of any Blockdeamon API Suite endpoint, add the following: ?apiKey=YOUR_API_KEY.

https://svc.blockdaemon.com/tokens/v1/{protocol}/{network}/{token_addr}/check_transfer_restriction?apiKey=YOUR_API_KEY

Authentication with a query parameter can be used with any tool - no additional actions are needed.

📘

Info:

Note that if the query has additional parameters, replace ? with &.

2.2. Using Your API Key as a Bearer Token

In the authorization header, you can authenticate Blockdeamon API Suite API requests by setting your API key (YOUR_API_KEY) as a bearer token. Here are the instructions for doing this in cURL and Postman.

2.2.1. Bearer Token in cURL

For example, to check transfer restrictions using our Tokenization API, use the following code:

curl --request POST 'https://svc.blockdaemon.com/tokens/v1/{protocol}/{network}/{token_addr}/check_transfer_restriction' \
--header 'Content-Type: application/json'
--header 'Authorization: Bearer YOUR_API_KEY'

Or, if you prefer to use short options, run the following:

curl -X POST 'https://svc.blockdaemon.com/tokens/v1/{protocol}/{network}/{token_addr}/check_transfer_restriction' \
-H 'Content-Type: application/json'
-H 'Authorization: Bearer YOUR_API_KEY'

2.2.2. Bearer Token in Postman

In Postman, you can set your API key as a bearer token for a particular request and a collection of requests. To do this, go to a request or collection tab and do the following:

  1. Navigate to the Authorization or Auth tab.
  2. Select Bearer Token from the Type drop-down menu.
  3. Paste your API key into the Token input box.

Then you can run your request.

3. Using Your API Key as an X-API-Key

You can authenticate Blockdeamon API Suite API requests by passing your API key in the X-API-Key header. Here are the instructions for doing this in cURL and Postman.

3.1. X-API-Key in cURL

For example, to check transfer restrictions using our Tokenization API, use the following code:

curl --request POST 'https://svc.blockdaemon.com/tokens/v1/{protocol}/{network}/{token_addr}/check_transfer_restriction' 
--header 'Content-Type: application/json'
--header 'X-API-Key: YOUR_API_KEY'

Or, if you prefer to use short options, run the following:

curl -X POST 'https://svc.blockdaemon.com/tokens/v1/{protocol}/{network}/{token_addr}/check_transfer_restriction' \
-H 'Content-Type: application/json'
-H 'X-API-Key: YOUR_API_KEY' \

3.2. X-API-Key in Postman

In Postman, you can set your API key as an X-API-Key not only for a particular request but also for a collection of requests. Go to a request or collection tab and do the following:

  1. Navigate to the Authorization or Auth tab.
  2. Select API Key from the Type drop-down menu.
  3. Paste your API key into the Value input box.
  4. Ensure the Add to option is set to Header.

Then you can run your request.

4. Getting the Result

The example below shows a request example to check transfer restrictions. If your API key is correct, your request will be authorized.

curl -X POST 'https://svc.blockdaemon.com/tokens/v1/{protocol}/{network}/{token_addr}/check_transfer_restriction' \
-H 'Content-Type: application/json'
-H 'X-API-Key: YOUR_API_KEY'
-d '{
      "from":"0x7986b3D94fB18fedF6F9eb4eB28A44C8952C95E4", 
      "to":"0x2Ee91F2AD688A568367D0dDa98A4e1ffd0F111E5", 
      "value":1
}' \

It returns the transfer restriction result, which could be "No Restriction" or "Existing Restriction" for each token (ERC-1404/ERC-3643).

/** Restriction for ERC-1404 **/
{
    "can_transfer": false,
    "restriction_code": 1,
    "restriction_message": "The transfer was restricted due to white list configuration.",
    "standard": "ERC-1404"
}

If the key is incorrect or missing, you will get this error:

{
  "type": "unauthorized",
  "title": "Invalid Token",
  "status": 401
}

If the request is invalid, you will get this error:

{
  "type": "bad-request",
  "code": 16384,
  "title": "Invalid Address",
  "status": 400,
  "detail": "The requested address is invalid on this protocol"
}

👋 Need Help?

Contact us through email or our support page for any issues, bugs, or assistance you may need.