Developers
API Authentication
The Velosity API documentation is available here. To access the API, add X-APIKEY to the request header. You can generate an ApiKey from your profile in Velosity (top right icon, Profile, scroll down to API section)
First Call Using X-APIKEY
The first call to the API should use the X-APIKEY, which will return two cookies (contact SUPPORT for details). These cookies should be used on all subsequent calls to prevent rate limiting (necessary to prevent abusive unauthenticated calls). Too many calls will return a 429 error (Too Many Requests).
using RestSharp;
var client = new RestClient("https://api.velosity.app");
var request = new RestRequest("v1/setup/states", Method.GET);
request.AddHeader("X-APIKEY", "your-api-key");
var response = await client.ExecuteAsync(request);
// Extract cookies
var token1 = response.Cookies.FirstOrDefault(c => c.Name == "Token1")?.Value;
var token2 = response.Cookies.FirstOrDefault(c => c.Name == "Token2")?.Value;
Subsequent Call(s) Using Cookies (Token1, Token2)
// all subsequent calls should use these two cookies instead of X-APIKEY
var secondRequest = new RestRequest("v1/setup/states", Method.GET);
secondRequest.AddCookie("Token1", token1);
secondRequest.AddCookie("Token2", token2);
var secondResponse = await client.ExecuteAsync(secondRequest);
Console.WriteLine(secondResponse.Content);