Manage user accounts and track their usage using the Limitly REST API.

List Users

Get all users for your account:
curl -X GET \
  -H "Authorization: Bearer lk_1234567890abcdef1234567890abcdef" \
  https://api.limitly.dev/v1/users

Response

{
  "data": [
    {
      "user_id": 123,
      "name": "John Doe",
      "email": "john@example.com",
      "is_disabled": false,
      "created_at": "2024-01-01T00:00:00Z",
      "updated_at": "2024-01-01T00:00:00Z"
    }
  ],
  "count": 1
}

Create User

Create a new user account:
curl -X POST \
  -H "Authorization: Bearer lk_1234567890abcdef1234567890abcdef" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "John Doe",
    "email": "john@example.com"
  }' \
  https://api.limitly.dev/v1/users

Request Parameters

name
string
required
The name of the user
email
string
The email address of the user

Response

{
  "data": {
    "user_id": 123,
    "name": "John Doe",
    "email": "john@example.com",
    "is_disabled": false,
    "created_at": "2024-01-01T00:00:00Z",
    "updated_at": "2024-01-01T00:00:00Z"
  }
}

Get User

Retrieve a specific user by ID:
curl -X GET \
  -H "Authorization: Bearer lk_1234567890abcdef1234567890abcdef" \
  https://api.limitly.dev/v1/users/123

Response

{
  "data": {
    "user_id": 123,
    "name": "John Doe",
    "email": "john@example.com",
    "is_disabled": false,
    "created_at": "2024-01-01T00:00:00Z",
    "updated_at": "2024-01-01T00:00:00Z"
  }
}

Update User

Update an existing user:
curl -X PUT \
  -H "Authorization: Bearer lk_1234567890abcdef1234567890abcdef" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "John Smith",
    "email": "john.smith@example.com"
  }' \
  https://api.limitly.dev/v1/users/123

Request Parameters

name
string
New name for the user
email
string
New email address for the user
is_disabled
boolean
Whether the user account is disabled

Delete User

Delete a user account:
curl -X DELETE \
  -H "Authorization: Bearer lk_1234567890abcdef1234567890abcdef" \
  https://api.limitly.dev/v1/users/123

Response

{
  "data": {
    "message": "User deleted successfully"
  }
}

Get User Usage

Get usage statistics for a specific user:
curl -X GET \
  -H "Authorization: Bearer lk_1234567890abcdef1234567890abcdef" \
  https://api.limitly.dev/v1/users/123/usage

Response

{
  "data": {
    "type": "user",
    "current_usage": 45,
    "limit": 1000,
    "percentage_used": 4.5,
    "user_name": "John Doe",
    "plan_name": "Basic Plan"
  }
}

Get User API Keys

Get all API keys associated with a user:
curl -X GET \
  -H "Authorization: Bearer lk_1234567890abcdef1234567890abcdef" \
  https://api.limitly.dev/v1/users/123/keys

Response

{
  "data": [
    {
      "id": "key_123",
      "name": "Production API Key",
      "plan_id": "plan_789",
      "status": "active",
      "created_at": "2024-01-01T00:00:00Z"
    }
  ],
  "count": 1
}

Get User Requests

Get detailed request history for a user:
curl -X GET \
  -H "Authorization: Bearer lk_1234567890abcdef1234567890abcdef" \
  https://api.limitly.dev/v1/users/123/requests

Response

{
  "data": {
    "requests": [
      {
        "timestamp": "2024-01-01T12:00:00Z",
        "endpoint": "/api/users",
        "method": "GET",
        "status": "allowed",
        "ip_address": "192.168.1.1"
      }
    ],
    "count": 1
  }
}

User Status Management

Manage user account status:
# Activate a user
curl -X PUT \
  -H "Authorization: Bearer lk_1234567890abcdef1234567890abcdef" \
  -H "Content-Type: application/json" \
  -d '{
    "is_disabled": false
  }' \
  https://api.limitly.dev/v1/users/123

# Suspend a user
curl -X PUT \
  -H "Authorization: Bearer lk_1234567890abcdef1234567890abcdef" \
  -H "Content-Type: application/json" \
  -d '{
    "is_disabled": true
  }' \
  https://api.limitly.dev/v1/users/123

Search Users

Search for users by various criteria:
# Search by email
curl -X GET \
  -H "Authorization: Bearer lk_1234567890abcdef1234567890abcdef" \
  "https://api.limitly.dev/v1/users?email=john@example.com"

Error Responses

User Not Found

{
  "error": "User not found",
  "code": "USER_NOT_FOUND"
}

Validation Error

{
  "error": "Validation failed",
  "code": "VALIDATION_ERROR",
  "details": {
    "field": "email",
    "message": "Invalid email format"
  }
}

Duplicate Email

{
  "error": "Email already exists",
  "code": "DUPLICATE_EMAIL"
}

Pagination

List endpoints support pagination with the following query parameters:
page
number
Page number (default: 1)
limit
number
Number of items per page (default: 10, max: 100)

Example

curl -X GET \
  -H "Authorization: Bearer lk_1234567890abcdef1234567890abcdef" \
  "https://api.limitly.dev/v1/users?page=2&limit=20"

User Properties

The API supports the following user properties:
  • user_id: Unique identifier for the user
  • name: User’s display name
  • email: User’s email address (optional)
  • is_disabled: Whether the user account is disabled
  • created_at: Timestamp when the user was created
  • updated_at: Timestamp when the user was last updated

Next Steps