Skip to content

Users

A user of the Xref platform is identified by a unique number, first name, last name and email address.

List Users

Method GET
Path /users{?search}{?limit}{?page}

This endpoint returns a list of users associated with your company. The pages attribute in the response allows you to link to the current, previous and next pages.

Request

Headers

Authorization: Bearer YOUR_JWT_TOKEN_HERE
Content-Type: application/json

Parameters

Name Example / default Required Type Description
search "" No string Filter the list of users by searching on first_name, last_name and email fields. Default: ""
limit 20 No integer Limit the list of users to a certain number. Defaults to 20, maximum can be 100. Default: 20
page 1 No integer The page number in the list of users. Default: 1

Response

200 — application/json

{
"pages": {
    "total": 2,
    "links": {
        "this": "/users",
        "prev": "",
        "next": "/users?search=""&limit=20&page=2"
    }
},
"data": [
    {
        "id": 100,
        "first_name": "John",
        "last_name": "Doe",
        "email": "john.doe@email.com",
        "permissions": [
            "can_request_checks",
            "can_view_others_checks",
            "can_cancel_others_checks"
        ],
        "url": "/user/100"
    },
    {
        "id": 101,
        "first_name": "Joe",
        "last_name": "Bloggs",
        "email": "joe@example.com",
        "permissions": [
            "can_request_checks",
        ],
        "url": "/user/101"
    }
]
}

401 — application/json

{
"detail": "Authentication credentials were not provided."
}

403

Retrieve a User

Method GET
Path /user/{id}

This endpoint requires a specific User ID, and returns information such as the user's first name, last name and email address, as well as the user's permissions. The API returns a 404 error if the specified user is not found, and a 403 error if the requesting user does not have the permissions required to view the user's details.

Request

Headers

Authorization: Bearer YOUR_JWT_TOKEN_HERE
Content-Type: application/json

Parameters

Name Example / default Required Type Description
id 100 Yes number A unique identifier of the user.

Response

200 — application/json

Attributes (object)
AttributeTypeDescription
idnumberID of the user.
first_namestringUser's first name.
last_namestringUser's last name.
emailstringUser's email address.
permissionsarrayList of user's permissions.
can_request_checks
can_view_others_checks
can_cancel_others_checks
urlstringAPI endpoint to retrieve this object.
Body
{
    "id": 100,
    "first_name": "John",
    "last_name": "Doe",
    "email": "john.doe@email.com",
    "permissions": [
        "can_request_checks",
        "can_view_others_checks",
        "can_cancel_others_checks"
    ],
    "url": "/user/100"
}

401 — application/json

{
"detail": "Authentication credentials were not provided."
}

403