MENU navbar-image

Introduction

API de gestión de usuarios, roles y permisos del sistema.

This documentation aims to provide all the information you need to work with our API.

<aside>As you scroll, you'll see code examples for working with the API in different programming languages in the dark area to the right (or as part of the content on mobile).
You can switch the language used with the tabs at the top right (or from the nav menu at the top left on mobile).</aside>

Authenticating requests

To authenticate requests, include an Authorization header with the value "Bearer {YOUR_AUTH_KEY}".

All authenticated endpoints are marked with a requires authentication badge in the documentation below.

You can retrieve your token by visiting your dashboard and clicking Generate API token.

Endpoints

POST api/v1/auth/keycloak/logout

requires authentication

Example request:
curl --request POST \
    "http://localhost:8000/api/v1/auth/keycloak/logout" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://localhost:8000/api/v1/auth/keycloak/logout"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());

Request      

POST api/v1/auth/keycloak/logout

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

POST api/v1/roles

requires authentication

Example request:
curl --request POST \
    "http://localhost:8000/api/v1/roles" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"b\",
    \"description\": \"Et animi quos velit et fugiat.\",
    \"role_type\": \"user\",
    \"permissions\": [
        \"architecto\"
    ]
}"
const url = new URL(
    "http://localhost:8000/api/v1/roles"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "b",
    "description": "Et animi quos velit et fugiat.",
    "role_type": "user",
    "permissions": [
        "architecto"
    ]
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request      

POST api/v1/roles

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

name   string     

El campo value no debe contener más de 255 caracteres. Example: b

description   string  optional    

El campo value no debe contener más de 500 caracteres. Example: Et animi quos velit et fugiat.

role_type   string  optional    

Example: user

Must be one of:
  • administrator
  • operator
  • supervisor
  • user
permissions   string[]  optional    

PUT api/v1/roles/{id}

requires authentication

Example request:
curl --request PUT \
    "http://localhost:8000/api/v1/roles/architecto" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"b\",
    \"description\": \"Et animi quos velit et fugiat.\",
    \"role_type\": \"administrator\",
    \"permissions\": [
        \"architecto\"
    ]
}"
const url = new URL(
    "http://localhost:8000/api/v1/roles/architecto"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "b",
    "description": "Et animi quos velit et fugiat.",
    "role_type": "administrator",
    "permissions": [
        "architecto"
    ]
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request      

PUT api/v1/roles/{id}

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   string     

The ID of the role. Example: architecto

Body Parameters

name   string     

El campo value no debe contener más de 255 caracteres. Example: b

description   string  optional    

El campo value no debe contener más de 500 caracteres. Example: Et animi quos velit et fugiat.

role_type   string  optional    

Example: administrator

Must be one of:
  • administrator
  • operator
  • supervisor
  • user
permissions   string[]  optional    

POST api/v1/roles/assign

requires authentication

Example request:
curl --request POST \
    "http://localhost:8000/api/v1/roles/assign" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"user_id\": \"6ff8f7f6-1eb3-3525-be4a-3932c805afed\",
    \"role_name\": \"architecto\"
}"
const url = new URL(
    "http://localhost:8000/api/v1/roles/assign"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "user_id": "6ff8f7f6-1eb3-3525-be4a-3932c805afed",
    "role_name": "architecto"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request      

POST api/v1/roles/assign

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

user_id   string     

Must be a valid UUID. Example: 6ff8f7f6-1eb3-3525-be4a-3932c805afed

role_name   string     

The name of an existing record in the keycloak_roles table. Example: architecto

POST api/v1/roles/unassign

requires authentication

Example request:
curl --request POST \
    "http://localhost:8000/api/v1/roles/unassign" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"user_id\": \"6ff8f7f6-1eb3-3525-be4a-3932c805afed\",
    \"role_name\": \"architecto\"
}"
const url = new URL(
    "http://localhost:8000/api/v1/roles/unassign"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "user_id": "6ff8f7f6-1eb3-3525-be4a-3932c805afed",
    "role_name": "architecto"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request      

POST api/v1/roles/unassign

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

user_id   string     

Must be a valid UUID. Example: 6ff8f7f6-1eb3-3525-be4a-3932c805afed

role_name   string     

The name of an existing record in the keycloak_roles table. Example: architecto

POST api/v1/users

requires authentication

Example request:
curl --request POST \
    "http://localhost:8000/api/v1/users" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"email\": \"gbailey@example.net\",
    \"first_name\": \"m\",
    \"last_name\": \"i\",
    \"username\": \"y\",
    \"password\": \"pBNvYg\",
    \"enabled\": false,
    \"email_verified\": false,
    \"role_name\": \"architecto\",
    \"cellphone\": \"ngzmiyvdljnikhwa\"
}"
const url = new URL(
    "http://localhost:8000/api/v1/users"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "email": "gbailey@example.net",
    "first_name": "m",
    "last_name": "i",
    "username": "y",
    "password": "pBNvYg",
    "enabled": false,
    "email_verified": false,
    "role_name": "architecto",
    "cellphone": "ngzmiyvdljnikhwa"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request      

POST api/v1/users

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

Body Parameters

email   string     

El campo value debe ser una dirección de correo válida. Example: gbailey@example.net

first_name   string     

El campo value no debe contener más de 255 caracteres. Example: m

last_name   string     

El campo value no debe contener más de 255 caracteres. Example: i

username   string  optional    

El campo value no debe contener más de 255 caracteres. Example: y

password   string  optional    

El campo value debe contener al menos 8 caracteres. Example: pBNvYg

enabled   boolean  optional    

Example: false

email_verified   boolean  optional    

Example: false

role_name   string  optional    

The name of an existing record in the keycloak_roles table. Example: architecto

cellphone   string  optional    

El campo value no debe contener más de 20 caracteres. Example: ngzmiyvdljnikhwa

PUT api/v1/users/{id}

requires authentication

Example request:
curl --request PUT \
    "http://localhost:8000/api/v1/users/architecto" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"email\": \"gbailey@example.net\",
    \"first_name\": \"m\",
    \"last_name\": \"i\",
    \"enabled\": true,
    \"email_verified\": false,
    \"role_name\": \"architecto\",
    \"cellphone\": \"ngzmiyvdljnikhwa\"
}"
const url = new URL(
    "http://localhost:8000/api/v1/users/architecto"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "email": "gbailey@example.net",
    "first_name": "m",
    "last_name": "i",
    "enabled": true,
    "email_verified": false,
    "role_name": "architecto",
    "cellphone": "ngzmiyvdljnikhwa"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request      

PUT api/v1/users/{id}

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   string     

The ID of the user. Example: architecto

Body Parameters

email   string  optional    

El campo value debe ser una dirección de correo válida. Example: gbailey@example.net

first_name   string  optional    

El campo value no debe contener más de 255 caracteres. Example: m

last_name   string  optional    

El campo value no debe contener más de 255 caracteres. Example: i

enabled   boolean  optional    

Example: true

email_verified   boolean  optional    

Example: false

role_name   string  optional    

The name of an existing record in the keycloak_roles table. Example: architecto

cellphone   string  optional    

El campo value no debe contener más de 20 caracteres. Example: ngzmiyvdljnikhwa