GET
/
v1
/
users
/
:id
# Get a user with their memberships, company details, and membership-company relationships
curl https://api.usertour.io/v1/users/usr_123456789?expand[]=memberships&expand[]=memberships.company&expand[]=companies \
-H 'Authorization: Bearer ak_123456789' \
-H 'Content-Type: application/json'
{
  "id": "usr_123456789",
  "object": "user",
  "attributes": {
    "name": "John Doe",
    "email": "john.doe@example.com",
    "role": "admin",
    "department": "engineering",
    "signed_up_at": "2024-03-20T08:30:00.000Z"
  },
  "createdAt": "2024-03-20T08:30:00.000Z",
  "companies": [
    {
      "id": "comp_123456789",
      "object": "company",
      "attributes": {
        "name": "Acme Corp",
        "domain": "acme.com"
      },
      "createdAt": "2024-03-20T08:30:00.000Z"
    }
  ],
  "memberships": [
    {
      "id": "cma9nhdis0002108kpmr9vfrl",
      "object": "companyMembership",
      "attributes": {
        "role": "admin",
        "department": "engineering"
      },
      "createdAt": "2024-03-20T08:30:00.000Z",
      "companyId": "comp_123456789",
      "userId": "usr_123456789",
      "company": {
        "id": "comp_123456789",
        "object": "company",
        "attributes": {
          "name": "Acme Corp",
          "domain": "acme.com"
        },
        "createdAt": "2024-03-20T08:30:00.000Z"
      }
    }
  ]
}

Path Parameters

id
string
required

The unique identifier of the user to retrieve. This ID should match the user’s identifier in your system.

Query Parameters

expand
string | string[]

See Expanding objects. Available options:

  • memberships: Include basic membership data for each user
  • memberships.company: Include both membership and associated company details
  • companies: Include all companies associated with the user
  • You can request multiple expansions: expand[]=memberships&expand[]=companies

Response

Returns a user object if found. Returns a 404 Not Found error if the user doesn’t exist.

# Get a user with their memberships, company details, and membership-company relationships
curl https://api.usertour.io/v1/users/usr_123456789?expand[]=memberships&expand[]=memberships.company&expand[]=companies \
-H 'Authorization: Bearer ak_123456789' \
-H 'Content-Type: application/json'
{
  "id": "usr_123456789",
  "object": "user",
  "attributes": {
    "name": "John Doe",
    "email": "john.doe@example.com",
    "role": "admin",
    "department": "engineering",
    "signed_up_at": "2024-03-20T08:30:00.000Z"
  },
  "createdAt": "2024-03-20T08:30:00.000Z",
  "companies": [
    {
      "id": "comp_123456789",
      "object": "company",
      "attributes": {
        "name": "Acme Corp",
        "domain": "acme.com"
      },
      "createdAt": "2024-03-20T08:30:00.000Z"
    }
  ],
  "memberships": [
    {
      "id": "cma9nhdis0002108kpmr9vfrl",
      "object": "companyMembership",
      "attributes": {
        "role": "admin",
        "department": "engineering"
      },
      "createdAt": "2024-03-20T08:30:00.000Z",
      "companyId": "comp_123456789",
      "userId": "usr_123456789",
      "company": {
        "id": "comp_123456789",
        "object": "company",
        "attributes": {
          "name": "Acme Corp",
          "domain": "acme.com"
        },
        "createdAt": "2024-03-20T08:30:00.000Z"
      }
    }
  ]
}