Users API
The Users API allows you to manage user accounts, profiles, and access within your 0.link organization. This endpoint is available on Pro and Enterprise plans.
Base URL
https://api.0link.com/v2/usersAuthentication
All Users API endpoints require authentication and admin or user_management permissions.
List Users
Get a list of all users in your organization.
http
GET /usersParameters
| Parameter | Type | Description |
|---|---|---|
limit | integer | Number of users to return (1-100, default: 25) |
cursor | string | Pagination cursor |
status | string | Filter by status: active, invited, suspended |
role | string | Filter by role: admin, developer, viewer |
search | string | Search by name or email |
Example Request
bash
curl -H "Authorization: Bearer YOUR_API_KEY" \
"https://api.0link.com/v2/users?limit=50&status=active"Example Response
json
{
"status": "success",
"data": [
{
"id": "user_1234567890",
"email": "john.doe@example.com",
"name": "John Doe",
"role": "developer",
"status": "active",
"avatar_url": "https://cdn.0link.com/avatars/user_1234567890.jpg",
"last_active": "2024-01-15T09:30:00Z",
"created_at": "2024-01-01T00:00:00Z",
"permissions": ["read", "write"],
"projects": ["proj_123", "proj_456"]
}
],
"pagination": {
"has_more": true,
"next_cursor": "eyJpZCI6IjUwIn0=",
"limit": 25,
"total_count": 47
}
}Get User
Retrieve details for a specific user.
http
GET /users/{user_id}Example Request
bash
curl -H "Authorization: Bearer YOUR_API_KEY" \
https://api.0link.com/v2/users/user_1234567890Example Response
json
{
"status": "success",
"data": {
"id": "user_1234567890",
"email": "john.doe@example.com",
"name": "John Doe",
"role": "developer",
"status": "active",
"avatar_url": "https://cdn.0link.com/avatars/user_1234567890.jpg",
"bio": "Frontend developer with 5 years experience",
"location": "San Francisco, CA",
"timezone": "America/Los_Angeles",
"last_active": "2024-01-15T09:30:00Z",
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-15T08:00:00Z",
"permissions": ["read", "write"],
"projects": [
{
"id": "proj_123",
"name": "Project Alpha",
"role": "contributor"
}
],
"api_keys": [
{
"id": "key_abc123",
"name": "Development Key",
"last_used": "2024-01-15T09:30:00Z"
}
]
}
}Invite User
Send an invitation to a new user.
http
POST /users/inviteRequest Body
json
{
"email": "newuser@example.com",
"name": "New User",
"role": "developer",
"permissions": ["read", "write"],
"project_ids": ["proj_123"],
"message": "Welcome to our team!"
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
email | string | ✅ | User's email address |
name | string | ✅ | User's full name |
role | string | ✅ | User role: admin, developer, viewer |
permissions | array | ❌ | API permissions (default: based on role) |
project_ids | array | ❌ | Project access list |
message | string | ❌ | Custom invitation message |
Example Request
bash
curl -X POST \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"email": "newuser@example.com",
"name": "New User",
"role": "developer",
"permissions": ["read", "write"]
}' \
https://api.0link.com/v2/users/inviteExample Response
json
{
"status": "success",
"data": {
"id": "user_0987654321",
"email": "newuser@example.com",
"name": "New User",
"role": "developer",
"status": "invited",
"invitation": {
"sent_at": "2024-01-15T10:30:00Z",
"expires_at": "2024-01-22T10:30:00Z",
"accept_url": "https://dashboard.0link.com/accept/inv_123456"
},
"permissions": ["read", "write"],
"created_at": "2024-01-15T10:30:00Z"
}
}Update User
Update an existing user's information.
http
PATCH /users/{user_id}Request Body
json
{
"name": "Updated Name",
"role": "admin",
"permissions": ["read", "write", "admin"],
"status": "active"
}Example Request
bash
curl -X PATCH \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"role": "admin",
"permissions": ["read", "write", "admin"]
}' \
https://api.0link.com/v2/users/user_1234567890Delete User
Remove a user from your organization.
http
DELETE /users/{user_id}Example Request
bash
curl -X DELETE \
-H "Authorization: Bearer YOUR_API_KEY" \
https://api.0link.com/v2/users/user_1234567890Example Response
json
{
"status": "success",
"data": {
"id": "user_1234567890",
"deleted": true,
"deleted_at": "2024-01-15T10:30:00Z"
}
}User Roles
Admin
- Full access to all resources
- User management capabilities
- Billing and account settings
- API key management
Developer
- Create and manage projects
- Upload and manage assets
- Configure integrations
- Access analytics
Viewer
- Read-only access to resources
- View analytics and reports
- No modification capabilities
Error Responses
User Not Found
json
{
"status": "error",
"error": {
"code": "USER_NOT_FOUND",
"message": "The specified user was not found",
"user_id": "user_invalid123"
}
}Insufficient Permissions
json
{
"status": "error",
"error": {
"code": "INSUFFICIENT_PERMISSIONS",
"message": "You don't have permission to manage users",
"required_permission": "user_management"
}
}Invalid Email
json
{
"status": "error",
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid email address format",
"field": "email"
}
}Code Examples
JavaScript
javascript
// List all active users
const users = await client.users.list({
status: 'active',
limit: 50
});
// Invite a new user
const invitation = await client.users.invite({
email: 'newuser@example.com',
name: 'New User',
role: 'developer'
});
// Update user role
await client.users.update('user_123', {
role: 'admin',
permissions: ['read', 'write', 'admin']
});Python
python
# List all active users
users = client.users.list(status='active', limit=50)
# Invite a new user
invitation = client.users.invite(
email='newuser@example.com',
name='New User',
role='developer'
)
# Update user role
client.users.update('user_123', {
'role': 'admin',
'permissions': ['read', 'write', 'admin']
})Webhooks
The Users API triggers these webhook events:
user.invited- User invitation sentuser.accepted- User accepted invitationuser.updated- User information changeduser.deleted- User removed from organizationuser.role_changed- User role modified
Example Webhook Payload
json
{
"event_type": "user.invited",
"event_id": "evt_123456",
"timestamp": "2024-01-15T10:30:00Z",
"data": {
"user": {
"id": "user_987654",
"email": "newuser@example.com",
"role": "developer",
"status": "invited"
},
"invited_by": {
"id": "user_123456",
"name": "Admin User"
}
}
}Best Practices
Security
- Regularly audit user access and permissions
- Remove users who no longer need access
- Use role-based permissions appropriately
- Monitor user activity for suspicious behavior
Management
- Use descriptive names for users
- Keep user information up to date
- Implement proper onboarding/offboarding processes
- Document user roles and responsibilities
Rate Limits
Users API endpoints have specific rate limits:
- List/Get operations: 100 requests per minute
- Invite operations: 20 requests per minute
- Update/Delete operations: 50 requests per minute