API reference
Every public REST endpoint, with its parameters, request body, responses and a request in your language.
https://api.stellards.io
- Records Read, add, change and delete the records of a table, and upload or download the files in its Blob fields. 8 endpoints
- Tables Create, rename and delete the tables of a project. 9 endpoints
- Fields Add, change and remove the fields (columns) of a table. See Field types for every type and the values it accepts. 9 endpoints
- Custom queries Run your own read-only SQL SELECT against a project. See the Custom queries guide for the syntax and limits. 6 endpoints
- Procedures Store a sequence of queries under a name and run it in one call, with parameters. 12 endpoints
- Webhooks Register URLs that receive a signed POST when something changes in a project. See the Webhooks guide for the payloads and signatures. 9 endpoints
- Backups Download a project as a zip file and restore it later. 2 endpoints
- Projects & plans Read and update your projects, and see the limits and usage of a project's plan. 4 endpoints
- OAuth Trade an authorization code or refresh token for tokens, and revoke refresh tokens. See Getting Started for the whole sign-in flow. 2 endpoints
- Account The signed-in user's own account and permissions. 3 endpoints
Authentication
Every call except the OAuth token endpoints and /v1/ping needs a token in the Authorization header:
- An access token for your own servers and scripts. Create one in the console under Applications, on the Access Tokens tab; it gets the permissions of the role you give it.
- An OAuth access token when people sign in to your app with their Stellar DataStore account. Getting Started walks through the flow.
Your first call, listing the projects the token can reach. Pick your language; the choice sticks on every page.
curl -X GET 'https://api.stellards.io/v1/schema/project' \
-H 'Authorization: Bearer ACCESS_TOKEN'
const response = await fetch("https://api.stellards.io/v1/schema/project", {
headers: {
Authorization: "Bearer ACCESS_TOKEN",
},
});
const result = await response.json();
console.log(result);
import requests
response = requests.get(
"https://api.stellards.io/v1/schema/project",
headers={"Authorization": "Bearer ACCESS_TOKEN"},
)
print(response.json())
using System.Net.Http.Headers;
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "ACCESS_TOKEN");
var response = await client.GetAsync("https://api.stellards.io/v1/schema/project");
Console.WriteLine(await response.Content.ReadAsStringAsync());
uses
System.Classes, System.SysUtils, System.Net.HttpClient, System.Net.URLClient;
var
Client: THTTPClient;
Response: IHTTPResponse;
begin
Client := THTTPClient.Create;
try
Client.CustomHeaders['Authorization'] := 'Bearer ACCESS_TOKEN';
Response := Client.Get('https://api.stellards.io/v1/schema/project');
Writeln(Response.ContentAsString);
finally
Client.Free;
end;
end;
Two route styles
Most endpoints take the project, table and field as query parameters, as in /v1/schema/table?project=PROJECT_ID. Tables, fields, custom queries and procedures can also be reached with the ids in the path, as in /project/PROJECT_ID/table. Both do the same; each section lists the path-style routes after the others.
Responses
Every JSON response has the same shape. isSuccess tells you whether the call worked, messages explains what went wrong when it didn't, and data holds the result. Record queries also return count, the number of records that match before paging.
This is what creating a table without a name returns:
{
"messages": [
{ "code": "BadRequest", "message": "The Name field is required.", "type": 30 }
],
"isSuccess": false
}
A message's type is 10 for information, 20 for a warning, 30 for an error, 31 for a database error and 32 for a value that couldn't be read.
Status codes
| Status | Meaning |
|---|---|
| 200, 201 | The call worked; 201 when something was created. |
| 400 | The request isn't valid: a missing parameter, a value that doesn't fit its field, or a plan limit. messages says which. |
| 401 | No token, or an expired one. Refresh it and try again. |
| 403 | The token's role doesn't allow this, or the project's plan doesn't include it. |
| 404 | The project, table, field or record doesn't exist. |
| 429 | Too many requests; wait the number of seconds in the Retry-After header. |
Rate limits
Each user or token can make 100 requests per minute. Above that the API answers 429 until the minute is over. Your plan also sets a number of requests per month; see Pricing.
Try it in the browser
The interactive API explorer sends real requests with your token, and the Run in Postman button in the sidebar forks a ready-made collection.