> For the complete documentation index, see [llms.txt](https://gotrustcrow.gitbook.io/trustcrow-api-v1/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gotrustcrow.gitbook.io/trustcrow-api-v1/api-reference/user-management/fetch-users.md).

# Fetch users

You can retrieve all customers or specify a customer by their ID. When fetching by ID, simply provide the customer's ID, and it will return the corresponding customer information.

## Fetch all users&#x20;

<mark style="color:blue;">`GET`</mark> `{{api_url}}/v1/users?page=1&limit=10&sort=DESC`

#### Query Parameters

| Name                                    | Type   | Description |
| --------------------------------------- | ------ | ----------- |
| page<mark style="color:red;">\*</mark>  | string | 1           |
| limit<mark style="color:red;">\*</mark> | string | 10          |
| sort<mark style="color:red;">\*</mark>  | string | DESC        |

#### Headers

| Name          | Type   | Description                                    |
| ------------- | ------ | ---------------------------------------------- |
| Authorization | string | your Trustcrow API keys to authorize customers |

{% tabs %}
{% tab title="200 Users retrieved successfully" %}

```javascript
{
    "status": true,
    "message": "Users retreived successfully",
    "data": {
        "users": [
            {
                "id": "369ea20c-212b-4b2a-9f87-31c7b11dec58",
                "first_name": "Haleemah",
                "last_name": "Opeyemi",
                "user_name": "haopho31079",
                "email": "haleemahfolag@yopmail.com",
                "default_email": "ec5fe1cf-dcf3-48b9-b003-7417fea0c0f1_haleemahfolag@yopmail.com",
                "phone": null,
                "password": null,
                "is_account_verified": true,
                "password_reset": false,
                "role": "USER",
                "referredById": null,
                "referral_code": null,
                "clientId": "ec5fe1cf-dcf3-48b9-b003-7417fea0c0f1",
                "source": "THIRD_PARTY",
                "public_key": null,
                "secret_key": null,
                "api_enabled": false,
                "password_created": false,
                "last_logged_in_at": null,
                "created_at": "2023-12-26T09:03:18.766Z",
                "updated_at": "2023-12-26T09:03:18.766Z"
            },
            {
                "id": "7ed4017f-5b88-4c53-997f-2f1fbd920d81",
                "first_name": "Haleemah",
                "last_name": "Opeyemi",
                "user_name": "haopho58794",
                "email": "haleemahfolagbade@yopmail.com",
                "default_email": "ec5fe1cf-dcf3-48b9-b003-7417fea0c0f1_haleemahfolagbade@yopmail.com",
                "phone": null,
                "password": null,
                "is_account_verified": true,
                "password_reset": false,
                "role": "USER",
                "referredById": null,
                "referral_code": null,
                "clientId": "ec5fe1cf-dcf3-48b9-b003-7417fea0c0f1",
                "source": "THIRD_PARTY",
                "public_key": null,
                "secret_key": null,
                "api_enabled": false,
                "password_created": false,
                "last_logged_in_at": null,
                "created_at": "2023-12-26T08:55:21.364Z",
                "updated_at": "2023-12-26T08:55:21.364Z"
            }
        ],
        "pagination": {
            "page": 1,
            "limit": 10,
            "prevPage": null,
            "nextPage": null,
            "currentPage": 1,
            "total": 2,
            "pageCount": 1,
            "pagingCounter": 1,
            "hasPrevPage": false,
            "hasNextPage": false
        }
    }
}
```

{% endtab %}
{% endtabs %}

## Fetch user by ID

<mark style="color:blue;">`GET`</mark> `{{api_url}}/v1/users/{user_id}`

#### Query Parameters

| Name                                       | Type   | Description             |
| ------------------------------------------ | ------ | ----------------------- |
| user\_id<mark style="color:red;">\*</mark> | string | specify the customer id |

#### Headers

| Name          | Type   | Description                                    |
| ------------- | ------ | ---------------------------------------------- |
| Authorization | string | your Trustcrow API keys to authorize customers |

{% tabs %}
{% tab title="200 User info returned successfully" %}

```javascript
{
    "status": true,
    "message": "User info returned successfully",
    "data": {
        "id": "369ea20c-212b-4b2a-9f87-31c7b11dec58",
        "first_name": "Haleemah",
        "last_name": "Opeyemi",
        "user_name": "haopho31079",
        "email": "haleemahfolag@yopmail.com",
        "default_email": "ec5fe1cf-dcf3-48b9-b003-7417fea0c0f1_haleemahfolag@yopmail.com",
        "phone": null,
        "password": null,
        "is_account_verified": true,
        "password_reset": false,
        "role": "USER",
        "referredById": null,
        "referral_code": null,
        "clientId": "ec5fe1cf-dcf3-48b9-b003-7417fea0c0f1",
        "source": "THIRD_PARTY",
        "public_key": null,
        "secret_key": null,
        "api_enabled": false,
        "password_created": false,
        "last_logged_in_at": null,
        "created_at": "2023-12-26T09:03:18.766Z",
        "updated_at": "2023-12-26T09:03:18.766Z"
    }
}
```

{% endtab %}
{% endtabs %}
