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

# Users

## GET /organization/v1/users

> Gets a users within the organization.

```json
{"openapi":"3.1.1","info":{"title":"MariaDB Cloud DBaaS API","version":"1.0"},"tags":[{"name":"Users"}],"servers":[{"url":"https://api.skysql.com/"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"apiKey","name":"X-API-Key","in":"header"}},"schemas":{"dto.User":{"type":"object","properties":{"created_by":{"type":"string"},"created_on":{"type":"integer"},"email":{"type":"string"},"first_name":{"type":"string"},"id":{"type":"string"},"invited":{"type":"boolean"},"is_active":{"type":"boolean"},"is_deleted":{"type":"boolean"},"last_name":{"type":"string"},"mfa_enabled":{"type":"boolean"},"org":{"$ref":"#/components/schemas/dto.Org"},"org_id":{"type":"string"},"roles":{"type":"array","items":{"type":"string"}},"updated_by":{"type":"string"},"updated_on":{"type":"integer"}}},"dto.Org":{"type":"object","properties":{"created_by":{"type":"string"},"created_on":{"type":"integer"},"current_owner":{"type":"string"},"id":{"type":"string"},"is_active":{"type":"boolean"},"is_deleted":{"type":"boolean"},"name":{"type":"string"},"tier":{"type":"string"},"updated_by":{"type":"string"},"updated_on":{"type":"integer"}}}}},"paths":{"/organization/v1/users":{"get":{"tags":["Users"],"summary":"Gets a users within the organization.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/dto.User"}}}}},"204":{"description":"No Content"}}}}}}
```

## POST /organization/v1/users/mfa

> Enable user MFA

```json
{"openapi":"3.1.1","info":{"title":"MariaDB Cloud DBaaS API","version":"1.0"},"tags":[{"name":"Users"}],"servers":[{"url":"https://api.skysql.com/"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"apiKey","name":"X-API-Key","in":"header"}},"schemas":{"errr.ErrorResponse":{"type":"object","properties":{"code":{"type":"integer"},"errors":{"type":"array","items":{"$ref":"#/components/schemas/errr.ErrorDetails"}},"exception":{"type":"string"},"metadata":{"type":"object","additionalProperties":true},"path":{"type":"string"},"timestamp":{"type":"integer"},"trace_id":{"type":"string"}}},"errr.ErrorDetails":{"type":"object","properties":{"error":{"type":"string"},"location":{"type":"string"},"message":{"type":"string"},"metadata":{"type":"object","additionalProperties":true},"solution":{"type":"string"},"type":{"$ref":"#/components/schemas/errr.Type"}}},"errr.Type":{"type":"string","enum":["fatal","error","warning"]}}},"paths":{"/organization/v1/users/mfa":{"post":{"tags":["Users"],"summary":"Enable user MFA","responses":{"204":{"description":"No Content"},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errr.ErrorResponse"}}}}}}}}}
```

## DELETE /organization/v1/users/mfa

> Deletes user MFA Registration

```json
{"openapi":"3.1.1","info":{"title":"MariaDB Cloud DBaaS API","version":"1.0"},"tags":[{"name":"Users"}],"servers":[{"url":"https://api.skysql.com/"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"apiKey","name":"X-API-Key","in":"header"}},"schemas":{"errr.ErrorResponse":{"type":"object","properties":{"code":{"type":"integer"},"errors":{"type":"array","items":{"$ref":"#/components/schemas/errr.ErrorDetails"}},"exception":{"type":"string"},"metadata":{"type":"object","additionalProperties":true},"path":{"type":"string"},"timestamp":{"type":"integer"},"trace_id":{"type":"string"}}},"errr.ErrorDetails":{"type":"object","properties":{"error":{"type":"string"},"location":{"type":"string"},"message":{"type":"string"},"metadata":{"type":"object","additionalProperties":true},"solution":{"type":"string"},"type":{"$ref":"#/components/schemas/errr.Type"}}},"errr.Type":{"type":"string","enum":["fatal","error","warning"]}}},"paths":{"/organization/v1/users/mfa":{"delete":{"tags":["Users"],"summary":"Deletes user MFA Registration","responses":{"204":{"description":"No Content"},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errr.ErrorResponse"}}}}}}}}}
```

## GET /organization/v1/users/{user\_id}

> Gets a user by user id within the organization.

```json
{"openapi":"3.1.1","info":{"title":"MariaDB Cloud DBaaS API","version":"1.0"},"tags":[{"name":"Users"}],"servers":[{"url":"https://api.skysql.com/"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"apiKey","name":"X-API-Key","in":"header"}},"schemas":{"dto.User":{"type":"object","properties":{"created_by":{"type":"string"},"created_on":{"type":"integer"},"email":{"type":"string"},"first_name":{"type":"string"},"id":{"type":"string"},"invited":{"type":"boolean"},"is_active":{"type":"boolean"},"is_deleted":{"type":"boolean"},"last_name":{"type":"string"},"mfa_enabled":{"type":"boolean"},"org":{"$ref":"#/components/schemas/dto.Org"},"org_id":{"type":"string"},"roles":{"type":"array","items":{"type":"string"}},"updated_by":{"type":"string"},"updated_on":{"type":"integer"}}},"dto.Org":{"type":"object","properties":{"created_by":{"type":"string"},"created_on":{"type":"integer"},"current_owner":{"type":"string"},"id":{"type":"string"},"is_active":{"type":"boolean"},"is_deleted":{"type":"boolean"},"name":{"type":"string"},"tier":{"type":"string"},"updated_by":{"type":"string"},"updated_on":{"type":"integer"}}}}},"paths":{"/organization/v1/users/{user_id}":{"get":{"tags":["Users"],"summary":"Gets a user by user id within the organization.","parameters":[{"schema":{"type":"string"},"description":"User identifier","name":"user_id","in":"path","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/dto.User"}}}}}}}}}
```

## PATCH /organization/v1/users/{user\_id}

> Update a user by user id within the organization.

```json
{"openapi":"3.1.1","info":{"title":"MariaDB Cloud DBaaS API","version":"1.0"},"tags":[{"name":"Users"}],"servers":[{"url":"https://api.skysql.com/"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"apiKey","name":"X-API-Key","in":"header"}},"schemas":{"errr.ErrorResponse":{"type":"object","properties":{"code":{"type":"integer"},"errors":{"type":"array","items":{"$ref":"#/components/schemas/errr.ErrorDetails"}},"exception":{"type":"string"},"metadata":{"type":"object","additionalProperties":true},"path":{"type":"string"},"timestamp":{"type":"integer"},"trace_id":{"type":"string"}}},"errr.ErrorDetails":{"type":"object","properties":{"error":{"type":"string"},"location":{"type":"string"},"message":{"type":"string"},"metadata":{"type":"object","additionalProperties":true},"solution":{"type":"string"},"type":{"$ref":"#/components/schemas/errr.Type"}}},"errr.Type":{"type":"string","enum":["fatal","error","warning"]},"dto.UpdateUser":{"type":"object","properties":{"activate":{"type":"boolean"},"first_name":{"type":"string"},"last_name":{"type":"string"}}}}},"paths":{"/organization/v1/users/{user_id}":{"patch":{"tags":["Users"],"summary":"Update a user by user id within the organization.","parameters":[{"schema":{"type":"string"},"description":"User identifier","name":"user_id","in":"path","required":true}],"responses":{"200":{"description":"OK"},"204":{"description":"No Content"},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errr.ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errr.ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/dto.UpdateUser"}}},"description":"Request Body","required":true}}}}}
```

## GET /organization/v1/users/{user\_id}/api-keys

> Gets all api keys for a user

```json
{"openapi":"3.1.1","info":{"title":"MariaDB Cloud DBaaS API","version":"1.0"},"tags":[{"name":"Users"}],"servers":[{"url":"https://api.skysql.com/"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"apiKey","name":"X-API-Key","in":"header"}},"schemas":{"dto.ApiKey":{"type":"object","properties":{"api_key":{"type":"string"},"created_by":{"type":"string"},"created_date":{"type":"integer"},"is_active":{"type":"boolean"},"key_id":{"type":"string"},"label":{"type":"string"},"updated_by":{"type":"string"},"updated_date":{"type":"integer"}}}}},"paths":{"/organization/v1/users/{user_id}/api-keys":{"get":{"tags":["Users"],"summary":"Gets all api keys for a user","parameters":[{"schema":{"type":"string"},"description":"User identifier","name":"user_id","in":"path","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/dto.ApiKey"}}}}}}}}}}
```

## POST /organization/v1/users/{user\_id}/api-keys

> Creates a new api key

```json
{"openapi":"3.1.1","info":{"title":"MariaDB Cloud DBaaS API","version":"1.0"},"tags":[{"name":"Users"}],"servers":[{"url":"https://api.skysql.com/"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"apiKey","name":"X-API-Key","in":"header"}},"schemas":{"dto.CreateAPIKey":{"type":"object","properties":{"label":{"type":"string"}}}}},"paths":{"/organization/v1/users/{user_id}/api-keys":{"post":{"tags":["Users"],"summary":"Creates a new api key","parameters":[{"schema":{"type":"string"},"description":"User identifier","name":"user_id","in":"path","required":true}],"responses":{"201":{"description":"Created"}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/dto.CreateAPIKey"}}},"description":"Request Body","required":true}}}}}
```

## GET /organization/v1/users/{user\_id}/api-keys/{key\_id}

> Gets key for a user by key id

```json
{"openapi":"3.1.1","info":{"title":"MariaDB Cloud DBaaS API","version":"1.0"},"tags":[{"name":"Users"}],"servers":[{"url":"https://api.skysql.com/"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"apiKey","name":"X-API-Key","in":"header"}},"schemas":{"dto.ApiKey":{"type":"object","properties":{"api_key":{"type":"string"},"created_by":{"type":"string"},"created_date":{"type":"integer"},"is_active":{"type":"boolean"},"key_id":{"type":"string"},"label":{"type":"string"},"updated_by":{"type":"string"},"updated_date":{"type":"integer"}}}}},"paths":{"/organization/v1/users/{user_id}/api-keys/{key_id}":{"get":{"tags":["Users"],"summary":"Gets key for a user by key id","parameters":[{"schema":{"type":"string"},"description":"User identifier","name":"user_id","in":"path","required":true},{"schema":{"type":"string"},"description":"Key identifier","name":"key_id","in":"path","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/dto.ApiKey"}}}}}}}}}
```

## DELETE /organization/v1/users/{user\_id}/api-keys/{key\_id}

> Delete key for a user by key id

```json
{"openapi":"3.1.1","info":{"title":"MariaDB Cloud DBaaS API","version":"1.0"},"tags":[{"name":"Users"}],"servers":[{"url":"https://api.skysql.com/"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"apiKey","name":"X-API-Key","in":"header"}}},"paths":{"/organization/v1/users/{user_id}/api-keys/{key_id}":{"delete":{"tags":["Users"],"summary":"Delete key for a user by key id","parameters":[{"schema":{"type":"string"},"description":"User identifier","name":"user_id","in":"path","required":true},{"schema":{"type":"string"},"description":"Key identifier","name":"key_id","in":"path","required":true}],"responses":{"204":{"description":"No Content"}}}}}}
```

## PATCH /organization/v1/users/{user\_id}/api-keys/{key\_id}

> Update key for a user by key id

```json
{"openapi":"3.1.1","info":{"title":"MariaDB Cloud DBaaS API","version":"1.0"},"tags":[{"name":"Users"}],"servers":[{"url":"https://api.skysql.com/"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"apiKey","name":"X-API-Key","in":"header"}}},"paths":{"/organization/v1/users/{user_id}/api-keys/{key_id}":{"patch":{"tags":["Users"],"summary":"Update key for a user by key id","parameters":[{"schema":{"type":"string"},"description":"User identifier","name":"user_id","in":"path","required":true},{"schema":{"type":"string"},"description":"Key identifier","name":"key_id","in":"path","required":true}],"responses":{"204":{"description":"No Content"}}}}}}
```

## DELETE /organization/v1/users/{user\_id}/roles

> Detaches RBAC role(s) to user by its user id within the organization.

```json
{"openapi":"3.1.1","info":{"title":"MariaDB Cloud DBaaS API","version":"1.0"},"tags":[{"name":"Users"},{"name":"Roles"}],"servers":[{"url":"https://api.skysql.com/"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"apiKey","name":"X-API-Key","in":"header"}},"schemas":{"errr.ErrorResponse":{"type":"object","properties":{"code":{"type":"integer"},"errors":{"type":"array","items":{"$ref":"#/components/schemas/errr.ErrorDetails"}},"exception":{"type":"string"},"metadata":{"type":"object","additionalProperties":true},"path":{"type":"string"},"timestamp":{"type":"integer"},"trace_id":{"type":"string"}}},"errr.ErrorDetails":{"type":"object","properties":{"error":{"type":"string"},"location":{"type":"string"},"message":{"type":"string"},"metadata":{"type":"object","additionalProperties":true},"solution":{"type":"string"},"type":{"$ref":"#/components/schemas/errr.Type"}}},"errr.Type":{"type":"string","enum":["fatal","error","warning"]},"dto.ChangeRole":{"type":"object","properties":{"roles":{"type":"array","items":{"type":"string"}}}}}},"paths":{"/organization/v1/users/{user_id}/roles":{"delete":{"tags":["Users","Roles"],"summary":"Detaches RBAC role(s) to user by its user id within the organization.","parameters":[{"schema":{"type":"string"},"description":"User identifier","name":"user_id","in":"path","required":true}],"responses":{"200":{"description":"OK"},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errr.ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errr.ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/dto.ChangeRole"}}},"description":"Request Body","required":true}}}}}
```

## PATCH /organization/v1/users/{user\_id}/roles

> Attaches RBAC role(s) to user by its user id within the organization.

```json
{"openapi":"3.1.1","info":{"title":"MariaDB Cloud DBaaS API","version":"1.0"},"tags":[{"name":"Users"},{"name":"Roles"}],"servers":[{"url":"https://api.skysql.com/"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"apiKey","name":"X-API-Key","in":"header"}},"schemas":{"errr.ErrorResponse":{"type":"object","properties":{"code":{"type":"integer"},"errors":{"type":"array","items":{"$ref":"#/components/schemas/errr.ErrorDetails"}},"exception":{"type":"string"},"metadata":{"type":"object","additionalProperties":true},"path":{"type":"string"},"timestamp":{"type":"integer"},"trace_id":{"type":"string"}}},"errr.ErrorDetails":{"type":"object","properties":{"error":{"type":"string"},"location":{"type":"string"},"message":{"type":"string"},"metadata":{"type":"object","additionalProperties":true},"solution":{"type":"string"},"type":{"$ref":"#/components/schemas/errr.Type"}}},"errr.Type":{"type":"string","enum":["fatal","error","warning"]},"dto.ChangeRole":{"type":"object","properties":{"roles":{"type":"array","items":{"type":"string"}}}}}},"paths":{"/organization/v1/users/{user_id}/roles":{"patch":{"tags":["Users","Roles"],"summary":"Attaches RBAC role(s) to user by its user id within the organization.","parameters":[{"schema":{"type":"string"},"description":"User identifier","name":"user_id","in":"path","required":true}],"responses":{"200":{"description":"OK"},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errr.ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errr.ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/dto.ChangeRole"}}},"description":"Request Body","required":true}}}}}
```
