Introduction
This documentation aims to provide all the information you need to work with our API.
Response body format:
{
"status": "success" | "error",
"error"?: string,
"data": any
}
Here is a list of general errors that could occur on almost every request:
- 401 - unauthenticated
- 403 - unauthorized
- 404 - not_found
- 405 - method_not_allowed
- 422 - validation
- 429 - too_many_requests
- 500 - internal_server_error
Base URL
https://api.trops.io
Authenticating requests
To authenticate requests, include an Authorization header with the value "Bearer {YOUR_AUTH_TOKEN}".
All authenticated endpoints are marked with a requires authentication badge in the documentation below.
Languages
Index
Example request:
curl --request GET \
--get "https://api.trops.io/languages" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://api.trops.io/languages"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://api.trops.io/languages',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200):
{
"status": "success",
"data": {
"languages": [
"aa",
"ab",
"ae",
...
]
}
}
Received response:
Request failed with error:
Branches
Store
requires authentication
Example request:
curl --request POST \
"https://api.trops.io/projects/e29b6898-0dea-3ccd-9f97-7be87dfec6f5/branches" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"name\": \"new_branch\"
}"
const url = new URL(
"https://api.trops.io/projects/e29b6898-0dea-3ccd-9f97-7be87dfec6f5/branches"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"name": "new_branch"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api.trops.io/projects/e29b6898-0dea-3ccd-9f97-7be87dfec6f5/branches',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'name' => 'new_branch',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200):
{
"status": "success",
"data": {
"name": "new_branch",
"term_count": 0,
"terms": [],
"uuid": "a369d404-b241-4968-a0f1-86bbe2a53613"
}
}
Received response:
Request failed with error:
Delete
requires authentication
Example request:
curl --request DELETE \
"https://api.trops.io/branches/e4b38d37-4d78-344c-a6ba-ed2052a5fae2" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://api.trops.io/branches/e4b38d37-4d78-344c-a6ba-ed2052a5fae2"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$response = $client->delete(
'https://api.trops.io/branches/e4b38d37-4d78-344c-a6ba-ed2052a5fae2',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200):
{
"status": "success",
"data": null
}
Example response (403):
{
"status": "error",
"error": "delete_main_branch",
"data": null
}
Received response:
Request failed with error:
Users
Register
Example request:
curl --request POST \
"https://api.trops.io/register" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"name\": \"John Doe\",
\"email\": \"john.doe@example.com\",
\"password\": \"4xY63RnDTF\",
\"language\": \"en\",
\"password_confirmation\": \"4xY63RnDTF\"
}"
const url = new URL(
"https://api.trops.io/register"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"name": "John Doe",
"email": "john.doe@example.com",
"password": "4xY63RnDTF",
"language": "en",
"password_confirmation": "4xY63RnDTF"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api.trops.io/register',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'name' => 'John Doe',
'email' => 'john.doe@example.com',
'password' => '4xY63RnDTF',
'language' => 'en',
'password_confirmation' => '4xY63RnDTF',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200):
{
"status": "success",
"data": {
"uuid": "40e6a8ed-a025-4fc1-bd2e-2eafaf189a46"
}
}
Received response:
Request failed with error:
Verify
Example request:
curl --request POST \
"https://api.trops.io/verify" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"uuid\": \"f4da622b-1219-4dab-aa00-53282d85651b\",
\"expires\": 1642722362,
\"signature\": \"b757e0008873ff1e73dc7e530cdd38b513c633629e9a451c6f62491c1ea5d8c9\"
}"
const url = new URL(
"https://api.trops.io/verify"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"uuid": "f4da622b-1219-4dab-aa00-53282d85651b",
"expires": 1642722362,
"signature": "b757e0008873ff1e73dc7e530cdd38b513c633629e9a451c6f62491c1ea5d8c9"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api.trops.io/verify',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'uuid' => 'f4da622b-1219-4dab-aa00-53282d85651b',
'expires' => 1642722362,
'signature' => 'b757e0008873ff1e73dc7e530cdd38b513c633629e9a451c6f62491c1ea5d8c9',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200):
{
"status": "success",
"data": null
}
Example response (403):
{
"status": "error",
"error": "invalid_signature",
"data": null
}
Example response (409):
{
"status": "error",
"error": "already_verified",
"data": null
}
Received response:
Request failed with error:
Login
Example request:
curl --request POST \
"https://api.trops.io/login" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"email\": \"john.doe@example.com\",
\"password\": \"4xY63RnDTF\"
}"
const url = new URL(
"https://api.trops.io/login"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"email": "john.doe@example.com",
"password": "4xY63RnDTF"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api.trops.io/login',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'email' => 'john.doe@example.com',
'password' => '4xY63RnDTF',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200):
{
"status": "success",
"data": {
"uuid": "ac41c471-0acb-3f89-bcda-ff8df2e3ba51",
"language": "sk",
"token": "1|v0ee69I7NOqBXjz4iiVBuuKAKhz3or1FGCVtNpmS"
}
}
Example response (401):
{
"status": "error",
"error": "wrong_credentials",
"data": null
}
Example response (401):
{
"status": "error",
"error": "not_verified",
"data": null
}
Received response:
Request failed with error:
OAuth URL
Example request:
curl --request GET \
--get "https://api.trops.io/login/github?language=en" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://api.trops.io/login/github"
);
const params = {
"language": "en",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://api.trops.io/login/github',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'language'=> 'en',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200):
{
"status": "success",
"data": {
"url": "https://github.com/login/oauth/authorize?client_id=1234&redirect_uri=http://api.trops.io/login/github/callback&scope=user:email&response_type=code
}
}
Received response:
Request failed with error:
Logout
requires authentication
Example request:
curl --request POST \
"https://api.trops.io/logout" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"all\": true
}"
const url = new URL(
"https://api.trops.io/logout"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"all": true
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api.trops.io/logout',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'all' => true,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200):
{
"status": "success",
"data": null
}
Example response (403):
{
"status": "error",
"error": "not_auth_token",
"data": null
}
Received response:
Request failed with error:
Projects
Index
requires authentication
Example request:
curl --request GET \
--get "https://api.trops.io/projects" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://api.trops.io/projects"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://api.trops.io/projects',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200):
{
"status": "success",
"data": {
"projects": [
{
"color": "#20603D",
"branches": [
{
"name": "main",
"term_count": 1,
"uuid": "a6a2ff68-a4b7-4f4c-840a-9c1369f35c69"
}
],
"default_lang": "en",
"description": "My first project",
"languages": [
"en",
"de",
"fr"
],
"name": "Project One",
"uuid": "613c6064-a23b-4166-bbdc-f25fb22f4e92"
}
]
}
}
Received response:
Request failed with error:
Store
requires authentication
Example request:
curl --request POST \
"https://api.trops.io/projects" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"name\": \"Project One\",
\"description\": \"My first project\",
\"default_lang\": \"en\",
\"color\": \"#20603D\",
\"languages\": [
\"en\",
\"de\",
\"fr\"
]
}"
const url = new URL(
"https://api.trops.io/projects"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"name": "Project One",
"description": "My first project",
"default_lang": "en",
"color": "#20603D",
"languages": [
"en",
"de",
"fr"
]
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api.trops.io/projects',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'name' => 'Project One',
'description' => 'My first project',
'default_lang' => 'en',
'color' => '#20603D',
'languages' => [
'en',
'de',
'fr',
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200):
{
"status": "success",
"data": {
"color": "#20603D",
"branches": [
{
"name": "main",
"term_count": 0,
"uuid": "a6a2ff68-a4b7-4f4c-840a-9c1369f35c69"
}
],
"default_lang": "en",
"description": "My first project",
"languages": [
"en",
"de",
"fr"
],
"name": "Project One",
"uuid": "613c6064-a23b-4166-bbdc-f25fb22f4e92"
}
}
Received response:
Request failed with error:
Show
requires authentication
Example request:
curl --request GET \
--get "https://api.trops.io/projects/3191a22d-bdcd-3d76-8645-df282d3dfc47?branch=6c5bac24-df7f-4e87-8f97-8f9f77ddc965" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://api.trops.io/projects/3191a22d-bdcd-3d76-8645-df282d3dfc47"
);
const params = {
"branch": "6c5bac24-df7f-4e87-8f97-8f9f77ddc965",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://api.trops.io/projects/3191a22d-bdcd-3d76-8645-df282d3dfc47',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'branch'=> '6c5bac24-df7f-4e87-8f97-8f9f77ddc965',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200):
{
"status": "success",
"data": {
"color": "#c3e6f8",
"branch": {
"uuid": "a6a2ff68-a4b7-4f4c-840a-9c1369f35c69",
"name": "main",
"term_count": 2,
"terms": {
"bbc70d55-2b64-43e9-9cd3-6ecffdfaba8b": {
"term": "term-1",
"terms": {
"3f747e12-6a47-4a61-8242-c8770bbc21ba": {
"term": "nested-term"
}
}
}
}
},
"branches": [
{
"name": "main",
"term_count": 2,
"uuid": "a6a2ff68-a4b7-4f4c-840a-9c1369f35c69"
}
],
"default_lang": "en",
"description": "My first project",
"languages": [
"en",
"de",
"fr"
],
"name": "Project One",
"uuid": "613c6064-a23b-4166-bbdc-f25fb22f4e92"
}
}
Received response:
Request failed with error:
Update
requires authentication
Example request:
curl --request PUT \
"https://api.trops.io/projects/0949c36b-6d99-32db-962a-2349d4f96bb6" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"name\": \"New project name\",
\"description\": \"My updated project description\",
\"default_lang\": \"ru\",
\"color\": \"#FF905A\",
\"languages\": [
\"pt\",
\"hi\",
\"tr\"
]
}"
const url = new URL(
"https://api.trops.io/projects/0949c36b-6d99-32db-962a-2349d4f96bb6"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"name": "New project name",
"description": "My updated project description",
"default_lang": "ru",
"color": "#FF905A",
"languages": [
"pt",
"hi",
"tr"
]
};
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$response = $client->put(
'https://api.trops.io/projects/0949c36b-6d99-32db-962a-2349d4f96bb6',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'name' => 'New project name',
'description' => 'My updated project description',
'default_lang' => 'ru',
'color' => '#FF905A',
'languages' => [
'pt',
'hi',
'tr',
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200):
{
"status": "success",
"data": {
"color": "#FF905A",
"branches": [
{
"name": "main",
"term_count": 1,
"uuid": "a6a2ff68-a4b7-4f4c-840a-9c1369f35c69"
}
],
"default_lang": "ru",
"description": "My updated project description",
"languages": [
"hi",
"pt",
"ru",
"tr"
],
"name": "New project name",
"uuid": "613c6064-a23b-4166-bbdc-f25fb22f4e92"
}
}
Received response:
Request failed with error:
Delete
requires authentication
Example request:
curl --request DELETE \
"https://api.trops.io/projects/3ec10078-8967-33c0-9ba6-aee36f06c331" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://api.trops.io/projects/3ec10078-8967-33c0-9ba6-aee36f06c331"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$response = $client->delete(
'https://api.trops.io/projects/3ec10078-8967-33c0-9ba6-aee36f06c331',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (200):
{
"status": "success",
"data": null
}
Received response:
Request failed with error:
Endpoints
GET _ignition/health-check
requires authentication
Example request:
curl --request GET \
--get "https://api.trops.io/_ignition/health-check" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://api.trops.io/_ignition/health-check"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://api.trops.io/_ignition/health-check',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (404):
Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin:
{
"status": "error",
"error": "not_found",
"data": null
}
Received response:
Request failed with error:
POST _ignition/execute-solution
requires authentication
Example request:
curl --request POST \
"https://api.trops.io/_ignition/execute-solution" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"solution\": \"porro\"
}"
const url = new URL(
"https://api.trops.io/_ignition/execute-solution"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"solution": "porro"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api.trops.io/_ignition/execute-solution',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'solution' => 'porro',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (404):
Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin:
{
"status": "error",
"error": "not_found",
"data": null
}
Received response:
Request failed with error:
POST _ignition/update-config
requires authentication
Example request:
curl --request POST \
"https://api.trops.io/_ignition/update-config" \
--header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"theme\": \"auto\",
\"editor\": \"harum\",
\"hide_solutions\": false
}"
const url = new URL(
"https://api.trops.io/_ignition/update-config"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"theme": "auto",
"editor": "harum",
"hide_solutions": false
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api.trops.io/_ignition/update-config',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'theme' => 'auto',
'editor' => 'harum',
'hide_solutions' => false,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));Example response (404):
Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin:
{
"status": "error",
"error": "not_found",
"data": null
}
Received response:
Request failed with error: