Users
GET /users
Retrieve a paginated list of users with optional filtering
curl -X GET "https://api.example.com/v2/users?page=1&limit=20&role=user&search=john" \
-H "Content-Type: application/json" \
-H "X-Request-ID: 123e4567-e89b-12d3-a456-426614174000" \
-H "Authorization: Bearer YOUR_API_TOKEN"
import requests
import json
url = "https://api.example.com/v2/users?page=1&limit=20&role=user&search=john"
headers = {
"Content-Type": "application/json",
"X-Request-ID": "123e4567-e89b-12d3-a456-426614174000",
"Authorization": "Bearer YOUR_API_TOKEN"
}
response = requests.get(url, headers=headers)
print(response.json())
const response = await fetch("https://api.example.com/v2/users?page=1&limit=20&role=user&search=john", {
method: "GET",
headers: {
"Content-Type": "application/json",
"X-Request-ID": "123e4567-e89b-12d3-a456-426614174000",
"Authorization": "Bearer YOUR_API_TOKEN"
}
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
)
func main() {
req, err := http.NewRequest("GET", "https://api.example.com/v2/users?page=1&limit=20&role=user&search=john", nil)
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-Request-ID", "123e4567-e89b-12d3-a456-426614174000")
req.Header.Set("Authorization", "Bearer YOUR_API_TOKEN")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://api.example.com/v2/users?page=1&limit=20&role=user&search=john')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Get.new(uri)
request['Content-Type'] = 'application/json'
request['X-Request-ID'] = '123e4567-e89b-12d3-a456-426614174000'
request['Authorization'] = 'Bearer YOUR_API_TOKEN'
response = http.request(request)
puts response.body
{
"users": [
{
"id": 1,
"name": "John Doe",
"email": "john@example.com",
"role": "user",
"created_at": "2024-01-15T10:00:00Z",
"last_active": "2024-12-25T15:30:00Z"
},
{
"id": 2,
"name": "Jane Smith",
"email": "jane@example.com",
"role": "admin",
"created_at": "2024-02-20T14:30:00Z",
"last_active": "2024-12-24T09:15:00Z"
}
],
"pagination": {
"page": 1,
"limit": 20,
"total": 150,
"has_next": true
}
}
{
"error": "BAD_REQUEST",
"message": "The request was invalid",
"code": 400
}
{
"error": "UNAUTHORIZED",
"message": "Authentication required",
"code": 401
}
{
"error": "FORBIDDEN",
"message": "Insufficient permissions",
"code": 403
}
GET
/users
GET
Security Scheme
X-API-Keystring
RequiredAPI key for authentication. Get your API key from the dashboard.
API key for authentication. Get your API key from the dashboard.
query
pageinteger
Page number for pagination
Min: 1
query
limitinteger
Number of users per page
Min: 1 • Max: 100
query
rolestring
Filter users by role
Options: admin, user, viewer
query
searchstring
Search users by name or email
header
X-Request-IDstring
Unique request identifier for tracing
Format: uuid
Request Preview
Response
Response will appear here after sending the request
Authentication
header
X-API-Keystring
RequiredAPI Key for authentication. API key for authentication. Get your API key from the dashboard.
Query Parameters
pageinteger
Page number for pagination
limitinteger
Number of users per page
rolestring
Filter users by role
searchstring
Search users by name or email
Headers
X-Request-IDstring
Unique request identifier for tracing
Responses
usersarray
paginationobject