User
Operations related to users
Get current authenticated user
/users/meRetrieves details for the currently authenticated user.
Security
Provide your bearer token in the Authorization header when making requests to protected resources.
Example: Authorization: Bearer YOUR_API_KEY
Code Examples
curl -X GET "/api/v1/users/me" \
-H "Authorization: Bearer YOUR_API_KEY"const response = await fetch('/api/v1/users/me', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
});
const data = await response.json();fetch('/api/v1/users/me', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
})
.then(response => response.json())
.then(data => console.log(data));import requests
headers = {
'Authorization': 'Bearer YOUR_API_KEY'
}
response = requests.get('/api/v1/users/me', headers=headers)
data = response.json()package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
req, _ := http.NewRequest("GET", "/api/v1/users/me", nil)
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
}Responses
{
"username": "johndoe",
"permissions": [
{
"resource": "orders_table",
"resource_type": "table",
"type": "read"
}
]
}{
"error": "An error message"
}{
"error": "An error message"
}List all users
/usersRetrieves a list of all users in the system. Requires admin permission.
Security
Provide your bearer token in the Authorization header when making requests to protected resources.
Example: Authorization: Bearer YOUR_API_KEY
Code Examples
curl -X GET "/api/v1/users" \
-H "Authorization: Bearer YOUR_API_KEY"const response = await fetch('/api/v1/users', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
});
const data = await response.json();fetch('/api/v1/users', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
})
.then(response => response.json())
.then(data => console.log(data));import requests
headers = {
'Authorization': 'Bearer YOUR_API_KEY'
}
response = requests.get('/api/v1/users', headers=headers)
data = response.json()package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
req, _ := http.NewRequest("GET", "/api/v1/users", nil)
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
}Responses
[
{
"username": "johndoe"
}
]{
"error": "An error message"
}{
"error": "An error message"
}{
"error": "An error message"
}Create a new user
/users/{userName}Creates a new user with the given username and password. Username in path takes precedence.
Security
Provide your bearer token in the Authorization header when making requests to protected resources.
Example: Authorization: Bearer YOUR_API_KEY
Request Body
Example:
{
"username": "johndoe",
"password": "s3cr3tP@sswOrd",
"initial_policies": [
{
"resource": "orders_table",
"resource_type": "table",
"type": "read"
}
]
}Code Examples
curl -X POST "/api/v1/users/{userName}" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"username": "johndoe",
"password": "s3cr3tP@sswOrd",
"initial_policies": [
{
"resource": "orders_table",
"resource_type": "table",
"type": "read"
}
]
}'const response = await fetch('/api/v1/users/{userName}', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"username": "johndoe",
"password": "s3cr3tP@sswOrd",
"initial_policies": [
{
"resource": "orders_table",
"resource_type": "table",
"type": "read"
}
]
})
});
const data = await response.json();fetch('/api/v1/users/{userName}', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"username": "johndoe",
"password": "s3cr3tP@sswOrd",
"initial_policies": [
{
"resource": "orders_table",
"resource_type": "table",
"type": "read"
}
]
})
})
.then(response => response.json())
.then(data => console.log(data));import requests
headers = {
'Authorization': 'Bearer YOUR_API_KEY'
}
response = requests.post(
'/api/v1/users/{userName}',
headers=headers,
json={
"username": "johndoe",
"password": "s3cr3tP@sswOrd",
"initial_policies": [
{
"resource": "orders_table",
"resource_type": "table",
"type": "read"
}
]
}
)
data = response.json()package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
body := []byte(`{
"username": "johndoe",
"password": "s3cr3tP@sswOrd",
"initial_policies": [
{
"resource": "orders_table",
"resource_type": "table",
"type": "read"
}
]
}`)
req, _ := http.NewRequest("POST", "/api/v1/users/{userName}", bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
}Responses
{
"username": "johndoe",
"password_hash": "JGFyZ29uMm..."
}{
"error": "An error message"
}{
"error": "An error message"
}{
"error": "An error message"
}Get user details
/users/{userName}Retrieves details for a specific user.
Security
Provide your bearer token in the Authorization header when making requests to protected resources.
Example: Authorization: Bearer YOUR_API_KEY
Code Examples
curl -X GET "/api/v1/users/{userName}" \
-H "Authorization: Bearer YOUR_API_KEY"const response = await fetch('/api/v1/users/{userName}', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
});
const data = await response.json();fetch('/api/v1/users/{userName}', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
})
.then(response => response.json())
.then(data => console.log(data));import requests
headers = {
'Authorization': 'Bearer YOUR_API_KEY'
}
response = requests.get('/api/v1/users/{userName}', headers=headers)
data = response.json()package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
req, _ := http.NewRequest("GET", "/api/v1/users/{userName}", nil)
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
}Responses
{
"username": "johndoe",
"password_hash": "JGFyZ29uMm..."
}{
"error": "An error message"
}{
"error": "An error message"
}{
"error": "An error message"
}Delete a user
/users/{userName}Deletes a specific user.
Security
Provide your bearer token in the Authorization header when making requests to protected resources.
Example: Authorization: Bearer YOUR_API_KEY
Code Examples
curl -X DELETE "/api/v1/users/{userName}" \
-H "Authorization: Bearer YOUR_API_KEY"const response = await fetch('/api/v1/users/{userName}', {
method: 'DELETE',
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
});
const data = await response.json();fetch('/api/v1/users/{userName}', {
method: 'DELETE',
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
})
.then(response => response.json())
.then(data => console.log(data));import requests
headers = {
'Authorization': 'Bearer YOUR_API_KEY'
}
response = requests.delete('/api/v1/users/{userName}', headers=headers)
data = response.json()package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
req, _ := http.NewRequest("DELETE", "/api/v1/users/{userName}", nil)
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
}Responses
{
"error": "An error message"
}{
"error": "An error message"
}{
"error": "An error message"
}Update user password
/users/{userName}/passwordUpdates the password for a specific user.
Security
Provide your bearer token in the Authorization header when making requests to protected resources.
Example: Authorization: Bearer YOUR_API_KEY
Request Body
Example:
{
"new_password": "newS3cr3tP@sswOrd"
}Code Examples
curl -X PUT "/api/v1/users/{userName}/password" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"new_password": "newS3cr3tP@sswOrd"
}'const response = await fetch('/api/v1/users/{userName}/password', {
method: 'PUT',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"new_password": "newS3cr3tP@sswOrd"
})
});
const data = await response.json();fetch('/api/v1/users/{userName}/password', {
method: 'PUT',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"new_password": "newS3cr3tP@sswOrd"
})
})
.then(response => response.json())
.then(data => console.log(data));import requests
headers = {
'Authorization': 'Bearer YOUR_API_KEY'
}
response = requests.put(
'/api/v1/users/{userName}/password',
headers=headers,
json={
"new_password": "newS3cr3tP@sswOrd"
}
)
data = response.json()package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
body := []byte(`{
"new_password": "newS3cr3tP@sswOrd"
}`)
req, _ := http.NewRequest("PUT", "/api/v1/users/{userName}/password", bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
}Responses
{
"message": "Operation completed successfully"
}{
"error": "An error message"
}{
"error": "An error message"
}{
"error": "An error message"
}