# User

This section contains the endpoint for user management. You can also view information from Stripe about this user.

## Suspend user

<mark style="color:orange;">`PUT`</mark> `{{BASE_URL}}/admin/api/users/{id}/suspend`

Suspend a specific user. When this endpoint is executed, all user resources will be stopped.

#### Path Parameters

| Name                                 | Type   | Description |
| ------------------------------------ | ------ | ----------- |
| id<mark style="color:red;">\*</mark> | String | User ID     |

#### Headers

| Name                                      | Type   | Description   |
| ----------------------------------------- | ------ | ------------- |
| Api-Key<mark style="color:red;">\*</mark> | String | Admin api key |

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "_id": "654a093e70c99a149c791faf",
    "status": 1,
    "balance": 0,
    "hubspotContactId": "206501",
    "emailVerified": true,
    "referrer": null,
    "name": "John Doe",
    "email": "john.doe@mail.com",
    "password": "$2b$08$xH5MUKNH7D8ZiNSsN1BBKeMA1dhO8C0ttTRuXiLvcV.SSsCbv60YO",
    "emailVerificationToken": "",
    "stripeId": "cus_OxhNYBXJyLjbnU",
    "createdAt": "2023-11-07T09:54:06.918Z",
    "updatedAt": "2023-11-07T13:26:54.191Z"
}
```

{% endtab %}
{% endtabs %}

## Activate user

<mark style="color:orange;">`PUT`</mark> `{{BASE_URL}}/admin/api/users/{id}/activate`

Resume access to the application for a specific user.

#### Path Parameters

| Name                                 | Type   | Description |
| ------------------------------------ | ------ | ----------- |
| id<mark style="color:red;">\*</mark> | String | User ID     |

#### Headers

| Name                                      | Type   | Description   |
| ----------------------------------------- | ------ | ------------- |
| Api-Key<mark style="color:red;">\*</mark> | String | Admin api key |

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "_id": "654a093e70c99a149c791faf",
    "status": 0,
    "balance": 0,
    "hubspotContactId": "206501",
    "emailVerified": true,
    "referrer": null,
    "name": "John Doe",
    "email": "john.doe@mail.com",
    "password": "$2b$08$xH5MUKNH7D8ZiNSsN1BBKeMA1dhO8C0ttTRuXiLvcV.SSsCbv60YO",
    "emailVerificationToken": "",
    "stripeId": "cus_OxhNYBXJyLjbnU",
    "createdAt": "2023-11-07T09:54:06.918Z",
    "updatedAt": "2023-11-07T13:27:37.298Z"
}
```

{% endtab %}
{% endtabs %}

## Deactivate user

<mark style="color:orange;">`PUT`</mark> `{{BASE_URL}}/admin/api/users/{id}/deactivate`

Deactivate a specific user. When this endpoint is executed, all user resources will be deleted. The user will not be able to log in to the application.

#### Path Parameters

| Name                                 | Type   | Description |
| ------------------------------------ | ------ | ----------- |
| id<mark style="color:red;">\*</mark> | String | User ID     |

#### Headers

| Name                                      | Type   | Description   |
| ----------------------------------------- | ------ | ------------- |
| Api-Key<mark style="color:red;">\*</mark> | String | Admin api key |

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "_id": "654a093e70c99a149c791faf",
    "status": 2,
    "balance": 0,
    "hubspotContactId": "206501",
    "emailVerified": true,
    "referrer": null,
    "name": "John Doe",
    "email": "john.doe@mail.com",
    "password": "$2b$08$xH5MUKNH7D8ZiNSsN1BBKeMA1dhO8C0ttTRuXiLvcV.SSsCbv60YO",
    "emailVerificationToken": "",
    "stripeId": "cus_OxhNYBXJyLjbnU",
    "createdAt": "2023-11-07T09:54:06.918Z",
    "updatedAt": "2023-11-07T13:28:03.505Z"
}
```

{% endtab %}
{% endtabs %}

## Delete user

<mark style="color:red;">`DELETE`</mark> `{{BASE_URL}}/admin/api/users/{id}/delete`

Delete a specific user. When this endpoint is executed, all user resources will be deleted.

#### Path Parameters

| Name                                 | Type   | Description |
| ------------------------------------ | ------ | ----------- |
| id<mark style="color:red;">\*</mark> | String | User ID     |

#### Headers

| Name                                      | Type   | Description   |
| ----------------------------------------- | ------ | ------------- |
| Api-Key<mark style="color:red;">\*</mark> | String | Admin api key |

{% tabs %}
{% tab title="200: OK " %}

```json
true
```

{% endtab %}
{% endtabs %}

## Get user payment methods

<mark style="color:blue;">`GET`</mark> `{{BASE_URL}}/admin/api/users/{id}/payment-methods`

Get all possible payment methods from a specific user.

#### Path Parameters

| Name                                 | Type   | Description |
| ------------------------------------ | ------ | ----------- |
| id<mark style="color:red;">\*</mark> | String | User ID     |

#### Headers

| Name                                      | Type   | Description   |
| ----------------------------------------- | ------ | ------------- |
| Api-Key<mark style="color:red;">\*</mark> | String | Admin api key |

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "object": "list",
    "data": [
        {
            "id": "pm_1O9OCiA0ZUrt0vQJ7GqrPclY",
            "object": "payment_method",
            "billing_details": {
                "address": {
                    "city": "Test",
                    "country": "DE",
                    "line1": "test",
                    "line2": "test",
                    "postal_code": "34334",
                    "state": "Test"
                },
                "email": "john.doe@mail.com",
                "name": "John Doe",
                "phone": null
            },
            "card": {
                "brand": "visa",
                "checks": {
                    "address_line1_check": "pass",
                    "address_postal_code_check": "pass",
                    "cvc_check": "pass"
                },
                "country": "US",
                "exp_month": 2,
                "exp_year": 2032,
                "fingerprint": "YxdxFzhKIAGEnLMN",
                "funding": "credit",
                "generated_from": null,
                "last4": "4242",
                "networks": {
                    "available": [
                        "visa"
                    ],
                    "preferred": null
                },
                "three_d_secure_usage": {
                    "supported": true
                },
                "wallet": null
            },
            "created": 1699259440,
            "customer": "cus_OxIokju2aarNVm",
            "livemode": false,
            "metadata": {},
            "type": "card"
        }
    ],
    "has_more": false,
    "url": "/v1/customers/cus_OxIokju2aarNVm/payment_methods"
}
```

{% endtab %}
{% endtabs %}

## Get STRIPE customer

<mark style="color:blue;">`GET`</mark> `{{BASE_URL}}/admin/api/users/{id}/retrieve`

Retrieves a Customer object.

#### Path Parameters

| Name                                 | Type   | Description |
| ------------------------------------ | ------ | ----------- |
| id<mark style="color:red;">\*</mark> | String | User ID     |

#### Headers

| Name                                      | Type   | Description   |
| ----------------------------------------- | ------ | ------------- |
| Api-Key<mark style="color:red;">\*</mark> | String | Admin api key |

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "id": "cus_OxIokju2aarNVm",
    "object": "customer",
    "address": {
        "city": "Test",
        "country": "Afghanistan",
        "line1": "Test",
        "line2": "test1",
        "postal_code": "34334",
        "state": "Test"
    },
    "balance": 0,
    "created": 1699259424,
    "currency": "usd",
    "default_source": null,
    "delinquent": false,
    "description": null,
    "discount": null,
    "email": "john.doe@mail.com",
    "invoice_prefix": "B96FCFF5",
    "invoice_settings": {
        "custom_fields": null,
        "default_payment_method": "pm_1O9OCiA0ZUrt0vQJ7GqrPclY",
        "footer": null,
        "rendering_options": null
    },
    "livemode": false,
    "metadata": {},
    "name": "John Doe",
    "phone": null,
    "preferred_locales": [],
    "shipping": null,
    "tax_exempt": "none",
    "test_clock": null
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.enclaive.cloud/enclaive-multi-cloud-platform/developers/api/admin-admin-api/accounts/team/user.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
