Skip to main content

Users API

The Users API lets you manage user accounts, roles, and team assignments programmatically. Useful for syncing with your HR system or building admin tools.

Endpoints

MethodEndpointDescription
GET/v1/usersList all users
GET/v1/users/:idGet a single user
POST/v1/usersCreate (invite) a new user
PATCH/v1/users/:idUpdate a user
DELETE/v1/users/:idDeactivate a user
GET/v1/users/:id/statsGet user performance stats
GET/v1/teamsList all teams

List Users

GET /v1/users

Query Parameters

ParameterTypeDescription
pageintegerPage number
per_pageintegerResults per page (max 100)
rolestringFilter by role: admin, manager, sales_rep
team_idUUIDFilter by team
statusstringactive, invited, deactivated
searchstringSearch by name or email

Example

curl -X GET "https://api.play2sell.com/v1/users?role=sales_rep&status=active" \
  -H "Authorization: Bearer YOUR_TOKEN"

Response

{
  "data": [
    {
      "id": "660e8400-e29b-41d4-a716-446655440001",
      "name": "Ana Costa",
      "email": "ana@company.com",
      "phone": "+5511977777777",
      "avatar_url": "https://api.play2sell.com/avatars/ana.jpg",
      "role": "sales_rep",
      "team": {
        "id": "770e8400-e29b-41d4-a716-446655440002",
        "name": "Enterprise Sales"
      },
      "status": "active",
      "ranking_tier": "gold",
      "total_points": 2350,
      "created_at": "2025-06-15T08:00:00Z",
      "last_active_at": "2026-03-15T09:30:00Z"
    }
  ],
  "meta": {
    "total": 32,
    "page": 1,
    "per_page": 25,
    "total_pages": 2
  }
}

Get a User

GET /v1/users/:id
Returns the full user profile including all fields and team information.

Create (Invite) a User

POST /v1/users
Creating a user sends an invitation email. The user must accept the invitation to set their password and activate their account.

Request Body

FieldTypeRequiredDescription
namestringYesUser’s full name
emailstringYesEmail address (invitation sent here)
rolestringYesadmin, manager, or sales_rep
team_idUUIDNoAssign to a team
phonestringNoPhone number

Example

curl -X POST "https://api.play2sell.com/v1/users" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Pedro Oliveira",
    "email": "pedro@company.com",
    "role": "sales_rep",
    "team_id": "770e8400-e29b-41d4-a716-446655440002"
  }'
Creating a user via the API counts toward your plan’s user limit, just like inviting from the UI.

Update a User

PATCH /v1/users/:id

Updatable Fields

FieldTypeDescription
namestringUser’s name
phonestringPhone number
rolestringChange the user’s role
team_idUUIDMove to a different team
curl -X PATCH "https://api.play2sell.com/v1/users/660e8400-e29b-41d4-a716-446655440001" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "role": "manager",
    "team_id": "770e8400-e29b-41d4-a716-446655440003"
  }'
Changing a user’s role takes effect immediately. The user’s permissions update on their next page load or API request.

Deactivate a User

DELETE /v1/users/:id
This deactivates the user rather than permanently deleting them. Deactivated users cannot log in, but their data (deals, leads, notes) is preserved. Returns 204 No Content on success. To permanently delete a user and their data, add the ?permanent=true query parameter. This action is irreversible.

Get User Stats

GET /v1/users/:id/stats

Query Parameters

ParameterTypeDescription
periodstringtoday, week, month, quarter, year, all_time

Example

curl -X GET "https://api.play2sell.com/v1/users/660e8400-e29b-41d4-a716-446655440001/stats?period=month" \
  -H "Authorization: Bearer YOUR_TOKEN"

Response

{
  "data": {
    "user_id": "660e8400-e29b-41d4-a716-446655440001",
    "period": "month",
    "points": 450,
    "ranking_position": 3,
    "deals_created": 8,
    "deals_won": 3,
    "deals_lost": 1,
    "revenue_closed": 47000,
    "leads_created": 15,
    "leads_qualified": 6,
    "conversion_rate": 0.75,
    "average_deal_size": 15667,
    "average_sales_cycle_days": 22,
    "badges_earned": 1,
    "activities_logged": 42
  }
}

List Teams

GET /v1/teams
Returns all teams in the organization:
{
  "data": [
    {
      "id": "770e8400-e29b-41d4-a716-446655440002",
      "name": "Enterprise Sales",
      "leader_id": "660e8400-e29b-41d4-a716-446655440005",
      "member_count": 8,
      "parent_team_id": null
    }
  ]
}

Next Steps