# Users

The Users API allows you to programmatically manage users within your Decube organization. You can create new users, fetch user details, deactivate users, and list all users in your account. These endpoints are useful for automating user onboarding and offboarding, auditing user status, and integrating user management into your internal workflows.

Use the endpoints below to:

* Add new users to your organization
* Retrieve user information by ID or email
* Deactivate (remove) users
* List all users and their statuses

## GET /user

> Endpoint to fetch a user for the organization.

```json
{"openapi":"3.1.0","info":{"title":"App Service","version":"0.1.0"},"servers":[{"url":"https://connect.<REGION>.decube.io/api/v1/app"}],"paths":{"/user":{"get":{"tags":["Users"],"description":"Endpoint to fetch a user for the organization.","operationId":"get_user","parameters":[{"name":"id","in":"query","required":false,"schema":{"type":["string","null"]}},{"name":"email","in":"query","required":false,"schema":{"type":["string","null"]}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicFormattedUser"}}}},"404":{"description":"User not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"422":{"description":"Both the ID and the email are not set.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"500":{"description":"An error occurred while handling the request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}}}}}},"components":{"schemas":{"PublicFormattedUser":{"type":"object","required":["id","name","email","status"],"properties":{"email":{"type":"string"},"id":{"type":"string"},"name":{"type":"string"},"status":{"$ref":"#/components/schemas/UserStatus"}}},"UserStatus":{"type":"string","enum":["active","deactivated","pending_sign_up"]},"ApiResponse":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}}
```

## POST /user

> Endpoint to create a user for the organization.

```json
{"openapi":"3.1.0","info":{"title":"App Service","version":"0.1.0"},"servers":[{"url":"https://connect.<REGION>.decube.io/api/v1/app"}],"paths":{"/user":{"post":{"tags":["Users"],"description":"Endpoint to create a user for the organization.","operationId":"create_user","parameters":[],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateUserRequest"}}},"required":true},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateUserResponse"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"500":{"description":"An error occurred while handling the request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}}}}}},"components":{"schemas":{"CreateUserRequest":{"type":"object","required":["name","email"],"properties":{"email":{"type":"string"},"name":{"type":"string"}}},"CreateUserResponse":{"type":"object","required":["id","name","email"],"properties":{"email":{"type":"string"},"id":{"type":"string"},"name":{"type":"string"}}},"ApiResponse":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}}
```

## DELETE /user

> Endpoint to deactivate a user for the organization.

```json
{"openapi":"3.1.0","info":{"title":"App Service","version":"0.1.0"},"servers":[{"url":"https://connect.<REGION>.decube.io/api/v1/app"}],"paths":{"/user":{"delete":{"tags":["Users"],"description":"Endpoint to deactivate a user for the organization.","operationId":"deactivate_user","parameters":[{"name":"email","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"User account deactivated successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"404":{"description":"User not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"500":{"description":"An error occurred while handling the request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}}}}}},"components":{"schemas":{"ApiResponse":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}}
```

## GET /users

> Endpoint to fetch users for the organization.

```json
{"openapi":"3.1.0","info":{"title":"App Service","version":"0.1.0"},"servers":[{"url":"https://connect.<REGION>.decube.io/api/v1/app"}],"paths":{"/users":{"get":{"tags":["Users"],"description":"Endpoint to fetch users for the organization.","operationId":"list_users","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":["integer","null"],"format":"int64","minimum":0}},{"name":"page_size","in":"query","required":false,"schema":{"type":["integer","null"],"format":"int64","minimum":0}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsersResponse"}}}},"500":{"description":"An error occurred while handling the request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}}}}}},"components":{"schemas":{"UsersResponse":{"type":"object","required":["users","count"],"properties":{"count":{"type":"integer","format":"int64","minimum":0},"users":{"type":"array","items":{"$ref":"#/components/schemas/PublicFormattedUser"}}}},"PublicFormattedUser":{"type":"object","required":["id","name","email","status"],"properties":{"email":{"type":"string"},"id":{"type":"string"},"name":{"type":"string"},"status":{"$ref":"#/components/schemas/UserStatus"}}},"UserStatus":{"type":"string","enum":["active","deactivated","pending_sign_up"]},"ApiResponse":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}}
```


---

# 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.decube.io/public-api/overview/control-api/users.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.
