API Overview
Let's discover Blocks API.
Using the API
In order to use the API, you would first need a X-Blocks-Key. Some API also require an acess token. We will show you how to acquire each of these.
Get the X-Blocks-Key
You can get the X-Blocks-Key by going to the Environment Overview Page. Hover to the right of the key to reveal a copy button. This key is specific to your project. If you want to access data for another project, you would have to use the key that belongs to that project.

Once you have your api key pass it as a header value.
Some endpoints require a project key. You can use the X-Blocks-Key as the project key.
Get an access token
To get the token, go to the authentication serivce. In the General tab, enable Client Credential. Head over to the Client Credential Tab and create a new one. Learn more about configuring client credentials here.
Once you have acquired an access token you can pass it as a header.
the access token is not needed for endpoints that are public. Please look at the required headers to know which endpoints require the access token.
Call the API
Now that you have configured client credentials and have the x-blocks-key, you are ready to make the api call.
- cURL
- JavaScript
- C#
curl --location 'https://api.seliseblocks.com/authentication/v1/OAuth/Token' \
--header 'x-blocks-key: <your-x-blocks-key>' \
--form 'grant_type="client_credential"' \
--form 'client_id="<YOUR_CLIENT_ID>"' \
--form 'client_secret="<YOUR_CLIENT_SECRET>"'
const url = "https://api.seliseblocks.com/authentication/v1/OAuth/Token";
async function getAccessToken() {
const formData = new FormData();
formData.append("grant_type", "client_credential");
formData.append("client_id", "<YOUR_CLIENT_ID>");
formData.append("client_secret", "<YOUR_CLIENT_SECRET>");
const response = await fetch(url, {
method: "POST",
headers: {
"x-blocks-key": <your-x-blocks-key>
},
body: formData
});
const data = await response.json();
console.log("Access Token:", data.access_token);
return data.access_token;
}
getAccessToken();
using System.Net.Http;
using System.Threading.Tasks;
public async Task<string> GetAccessTokenAsync()
{
var url = "https://api.seliseblocks.com/authentication/v1/OAuth/Token";
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("x-blocks-key", "<your-x-blocks-key>");
var form = new MultipartFormDataContent
{
{ new StringContent("client_credential"), "grant_type" },
{ new StringContent("<YOUR_CLIENT_ID>"), "client_id" },
{ new StringContent("<YOUR_CLIENT_SECRET>"), "client_secret" }
};
var response = await client.PostAsync(url, form);
var content = await response.Content.ReadAsStringAsync();
dynamic tokenData = Newtonsoft.Json.JsonConvert.DeserializeObject(content);
return tokenData.access_token;
}
In the reponse you will get the access token. With it, you are ready to use Blocks API!