> For the complete documentation index, see [llms.txt](https://docs.skyone.cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.skyone.cloud/english/api-skyone-autosky/users-api.md).

# Users API

API endpoints for managing System Access User objects.

**Base path:** `/users/`

***

## List Users

Queries users registered on the Autosky platform and linked to Clients.

```http
GET /users/
```

### Query parameters (optional)

| Parameter  | Type   | Description                           |
| ---------- | ------ | ------------------------------------- |
| `cli_uuid` | string | Client UUID to filter specific users. |

### Response

**Status:** `200 OK`

```json
[
    {
        "nome": "João",
        "sobrenome": "Souza",
        "email": "joao.souza@dominio.com",
        "ativo": true,
        "username": "joao.souza",
        "usr_uuid": "3bc705ab-5536-4193-bd5c-2d3e8ffd2e5b",
        "external_ad": false
    }
]
```

***

## Get User Data

Retrieves data for a specific user by their UUID. In addition to the fields from the user listing, the `clients` field is also included.

```http
GET /users/{usr_uuid}
```

### Path parameters

| Parameter  | Required | Description |
| ---------- | -------- | ----------- |
| `usr_uuid` | Yes      | User UUID   |

### Response

**Status:** `200 OK`

```json
{
    "nome": "João",
    "sobrenome": "Souza",
    "email": "joao.souza@dominio.com",
    "ativo": true,
    "username": "joao.souza",
    "usr_uuid": "3bc705ab-5536-4193-bd5c-2d3e8ffd2e5b",
    "clients": [
        {
            "cli_uuid": "79ea8324-4889-4729-8bf0-bc1c40b38273",
            "nome": "MeuCliente001",
            "grupo_seguranca": "Cliente001",
            "email_admin": "email-adm@dominio.com",
            "has_license_limit": false,
            "license_limit": 0,
            "amb_uuid": "715088c9-9f21-424e-bcd5-5eacc0ce165b"
        }
    ],
    "external_ad": false
}
```

***

## Create User

Performs the registration procedure for a new User on the platform.&#x20;

* If the User already exists, this procedure will only link them to the client passed as a parameter.
* Store the returned UUID from the user registration for future modifications if necessary.&#x20;
* If you have a specific Active Directory for your environment, use the `external_ad=true` property to set the password during registration.

```http
POST /users/
```

### Request Body

| Field                   | Type    | Required | Description                                                       |
| ----------------------- | ------- | -------- | ----------------------------------------------------------------- |
| `nome`                  | string  | Yes      | User's first name                                                 |
| `sobrenome`             | string  | No       | User's last name                                                  |
| `email`                 | string  | Yes      | User's logon email                                                |
| `ativo`                 | boolean | No       | If the user is active                                             |
| `username`              | string  | No       | User's name in AD.                                                |
| `password`              | string  | No       | User's password.                                                  |
| `cli_uuid`              | string  | Yes      | Client UUID where the user is being registered                    |
| `description`           | string  | No       | Additional user information                                       |
| `fullname`              | string  | No       | User's full name, must contain at least two separated words       |
| `external_ad`           | boolean | No       | Set to true if you have your own environment Active Directory.    |
| `send_activation_email` | boolean | No       | Indicates whether an activation email should be sent to the user. |

### Sample request

```json
{
    "nome": "Joao",
    "sobrenome": "Souza",
    "email": "joao.souza@dominio.com",
    "ativo": true,
    "username": "joao.souza",
    "password": "senha123",
    "cli_uuid": "769a0f4e-16a8-422a-99ab-d8c416137d4c",
    "description": "Informações do Usuário XXXX",
    "fullname": "Joao Souza Martins",
    "external_ad": false,
    "send_activation_email": false
}
```

### Response

**Status:** `200 OK`

```json
{
    "nome": "Joao",
    "sobrenome": "Souza",
    "email": "joao.souza@dominio.com",
    "ativo": true,
    "username": "joao.souza",
    "usr_uuid": "3bc705ab-5536-4193-bd5c-2d3e8ffd2e5b",
    "clients": [],
    "external_ad": true
}
```

***

## Edit User

Allows you to edit user information. Only certain information can be modified.

```http
PUT /users/{usr_uuid}
```

### Path parameters

| Parameter  | Required | Description |
| ---------- | -------- | ----------- |
| `usr_uuid` | Yes      | User UUID   |

### Request Body

| Field         | Type    | Description            |
| ------------- | ------- | ---------------------- |
| `nome`        | string  | User's first name      |
| `sobrenome`   | string  | User's last name       |
| `ativo`       | boolean | If the user is active  |
| `password`    | string  | User's password.       |
| `description` | string  | Additional Information |

### Sample request

```json
{
    "nome": "Joao",
    "sobrenome": "Souza",
    "ativo": true,
    "password": "senha123"
}
```

### Response

**Status:** `200 OK`

Returns the full updated user object, including the `clients` array.

***

## Enable / Disable User

Enable / Disable User

```http
PATCH /users/{usr_uuid}
```

### Path parameters

| Parameter  | Required | Description |
| ---------- | -------- | ----------- |
| `usr_uuid` | Yes      | User UUID   |

### Request Body

| Field                   | Type    | Required | Description                                     |
| ----------------------- | ------- | -------- | ----------------------------------------------- |
| `ativo`                 | boolean | Yes      | `true` to enable, `false` to disable            |
| `send_activation_email` | boolean | No       | Whether to send activation email                |
| `cli_uuid`              | string  | No       | Customer UUID associated with sending the email |

### Sample request

```json
{
    "ativo": true,
    "send_activation_email": false,
    "cli_uuid": "769a0f4e-16a8-422a-99ab-d8c416137d4c"
}
```

### Response

**Status:** `200 OK`

```json
{
    "nome": "João",
    "sobrenome": "Souza",
    "email": "joao.souza@dominio.com",
    "ativo": true,
    "username": "joao.souza",
    "cli_uuid": "769a0f4e-16a8-422a-99ab-d8c416137d4c"
}
```

***

## Change user password

Modifies a user's access password.

{% hint style="info" %}
**Note:** Password information is not stored in the Autosky platform database. It is stored directly in the authentication AD defined on the platform.
{% endhint %}

```http
PATCH /users/{usr_uuid}
```

### Path parameters

| Parameter  | Required | Description |
| ---------- | -------- | ----------- |
| `usr_uuid` | Yes      | User UUID   |

### Request Body

| Field      | Type   | Required | Description       |
| ---------- | ------ | -------- | ----------------- |
| `password` | string | Yes      | New user password |

### Sample request

```json
{
    "password": "NovaSenhaSegura@2024!"
}
```

### Response

**Status:** `200 OK`

```json
{
    "status": "success"
}
```

***

## Remove User

This endpoint removes a user or unlinks them from a specific client.

{% hint style="warning" %}
The endpoint does not always delete the user from the system. If the user is linked to more than one client, they will only be unlinked from the specified client (remaining active and with access to the other clients). If it is the user's last or only client, they will be completely removed and will lose access to the system.
{% endhint %}

### Request Parameters (Body)&#x20;

Unlike traditional deletion requests, this endpoint accepts and may require a body in `application/json` format.

* `cli_uuid` (string): Identifier of the client from which you wish to unlink the user.
  * Required if the user is linked to more than one client.
  * Optional if the user is linked to only one client.

Request Body Example:

```json
{
  "cli_uuid": "0e92037b-ed77-4a38-ab35-909637bea146"
}
```

### Responses&#x20;

* **`200 OK` - Success**&#x20;

The user was successfully removed from the system or unlinked from the client.

* **`200 OK` - Client Not Specified (Multiple Links)**

Returned when the user is linked to more than one client, but `cli_uuid` was not sent in the request body. *(Note: The returned HTTP status is 200, not a 4xx error*). The response will return the list of clients to which the user belongs so that one can be selected.

Exempl&#x65;*:*

```json
{
  "status": "error",
  "status_code": "USR006",
  "message": "Please inform a customer. (cli_uuid)",
  "clientes": [
    // List of clients linked to this user.
  ]
}
```

* **`404 Not Found` - Not Found**

The specified user does not exist or was not found.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.skyone.cloud/english/api-skyone-autosky/users-api.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
