# Users

## GET /users

> List users

```json
{"openapi":"3.1.1","info":{"title":"","version":"0.0.1"},"servers":[{"url":"/v1"}],"paths":{"/users":{"get":{"tags":["users"],"summary":"List users","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.UsersResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ErrorResponse"}}}}}}}},"components":{"schemas":{"model.UsersResponse":{"type":"object","properties":{"users":{"type":"array","items":{"$ref":"#/components/schemas/model.User"}}}},"model.User":{"type":"object","properties":{"apiVersion":{"type":"string"},"kind":{"allOf":[{"$ref":"#/components/schemas/model.Kind"}]},"metadata":{"$ref":"#/components/schemas/model.Metadata"},"spec":{"$ref":"#/components/schemas/model.UserSpec"},"status":{"$ref":"#/components/schemas/model.NoStatus"}}},"model.Kind":{"type":"string","enum":["Configuration","Agent","AgentType","AgentVersion","Source","Processor","Connector","Destination","Extension","SourceType","ProcessorType","ConnectorType","DestinationType","ExtensionType","RecommendationType","Unknown","Rollout","RolloutType","Organization","Account","Invitation","Login","User","AccountOrganizationBinding","UserOrganizationBinding","UserAccountBinding","AuditTrail","AvailableComponents","SecretsManagerType","SecretsManager","Recording","Credential","CredentialType","Fleet","Integration","IntegrationType","Notification","Recommendation"]},"model.Metadata":{"type":"object","properties":{"additionalInfo":{"$ref":"#/components/schemas/model.AdditionalInfo"},"dateModified":{"type":"string"},"deprecated":{"description":"Deprecated indicates that this resource is deprecated and should not be used. Deprecated resources should contain\nadditional information about why the resource is deprecated and what should be used instead.\nNote: Ironically, the Deprecated field is itself deprecated. Use Stability instead.","type":"boolean"},"description":{"type":"string"},"displayName":{"type":"string"},"hash":{"description":"Hash is a hex formatted sha256 Hash of the json-encoded spec that is used to determine if the spec has changed.","type":"string"},"icon":{"type":"string"},"id":{"type":"string"},"labels":{"$ref":"#/components/schemas/model.Labels"},"name":{"type":"string"},"resourceDocLink":{"type":"string"},"stability":{"description":"Stability is the stability of the resource, one of development, alpha, beta, stable, or\ndeprecated. This should be used instead of the Deprecated field.","allOf":[{"$ref":"#/components/schemas/model.Stability"}]},"version":{"description":"Version is a 1-based integer that is incremented each time the spec is changed.","type":"integer"},"warning":{"description":"Warning is an optional message that is displayed to the user when the resource is configured. Currently used for IntegrationTypes.","type":"string"}}},"model.AdditionalInfo":{"type":"object","properties":{"documentation":{"type":"array","items":{"$ref":"#/components/schemas/model.DocumentationLink"}},"message":{"type":"string"}}},"model.DocumentationLink":{"type":"object","properties":{"text":{"type":"string"},"url":{"type":"string"}}},"model.Labels":{"type":"object"},"model.Stability":{"type":"string","enum":["development","alpha","beta","stable","deprecated",""]},"model.UserSpec":{"type":"object","properties":{"activeAccount":{"type":"string"},"email":{"type":"string"},"nextLoginAccount":{"type":"string"},"requestedMFA":{"description":"RequestedMFA is true if the user has opted-in for multi-factor authentication. This is only supported when Auth0\nis configured as the authentication type.","type":"boolean"}}},"model.NoStatus":{"type":"object"},"model.ErrorResponse":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"string"}}}}}}}
```

## Add User to Current Project

> The /users route will add a new user to an existing project.\
> If the create flag is set, and the user doesn't already exist, it will create the user and\
> add a new login in addition to the the project binding.

```json
{"openapi":"3.1.1","info":{"title":"","version":"0.0.1"},"servers":[{"url":"/v1"}],"paths":{"/users":{"post":{"description":"The /users route will add a new user to an existing project.\nIf the create flag is set, and the user doesn't already exist, it will create the user and\nadd a new login in addition to the the project binding.","tags":["users"],"summary":"Add User to Current Project","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ApplyResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ErrorResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ErrorResponse"}}}},"422":{"description":"Tried to update a non-existing user, use the create flag to create a new user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.AddUserPayload"}}},"description":"Add User Payload"}}}},"components":{"schemas":{"model.ApplyResponse":{"type":"object","properties":{"updates":{"type":"array","items":{"$ref":"#/components/schemas/model.ResourceStatus"}}}},"model.ResourceStatus":{"type":"object","properties":{"before":{"description":"Before is the resource before the update, currently only used for audit events and omitted from API responses"},"reason":{"description":"Reason will be set if status is invalid or error","type":"string"},"resource":{"description":"Resource is the resource that was updated"},"status":{"description":"Status is the status of the resource after the update","allOf":[{"$ref":"#/components/schemas/model.UpdateStatus"}]}}},"model.UpdateStatus":{"type":"string","enum":["unchanged","configured","created","deleted","not-found","invalid","error","in-use","forbidden","deprecated"]},"model.ErrorResponse":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"string"}}}},"model.AddUserPayload":{"description":"Body of the request to add a user to an account","type":"object","properties":{"create":{"description":"Create should be true if the user should be created if they do not exist","type":"boolean"},"email":{"description":"Email address of the user to add","type":"string"},"name":{"description":"Name of the user to add","type":"string"}}}}}}
```

## GET /users/{id}

> Get user by id

```json
{"openapi":"3.1.1","info":{"title":"","version":"0.0.1"},"servers":[{"url":"/v1"}],"paths":{"/users/{id}":{"get":{"tags":["users"],"summary":"Get user by id","parameters":[{"schema":{"type":"string"},"description":"the id of the user","name":"id","in":"path","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.UserResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ErrorResponse"}}}}}}}},"components":{"schemas":{"model.UserResponse":{"type":"object","properties":{"user":{"$ref":"#/components/schemas/model.User"}}},"model.User":{"type":"object","properties":{"apiVersion":{"type":"string"},"kind":{"allOf":[{"$ref":"#/components/schemas/model.Kind"}]},"metadata":{"$ref":"#/components/schemas/model.Metadata"},"spec":{"$ref":"#/components/schemas/model.UserSpec"},"status":{"$ref":"#/components/schemas/model.NoStatus"}}},"model.Kind":{"type":"string","enum":["Configuration","Agent","AgentType","AgentVersion","Source","Processor","Connector","Destination","Extension","SourceType","ProcessorType","ConnectorType","DestinationType","ExtensionType","RecommendationType","Unknown","Rollout","RolloutType","Organization","Account","Invitation","Login","User","AccountOrganizationBinding","UserOrganizationBinding","UserAccountBinding","AuditTrail","AvailableComponents","SecretsManagerType","SecretsManager","Recording","Credential","CredentialType","Fleet","Integration","IntegrationType","Notification","Recommendation"]},"model.Metadata":{"type":"object","properties":{"additionalInfo":{"$ref":"#/components/schemas/model.AdditionalInfo"},"dateModified":{"type":"string"},"deprecated":{"description":"Deprecated indicates that this resource is deprecated and should not be used. Deprecated resources should contain\nadditional information about why the resource is deprecated and what should be used instead.\nNote: Ironically, the Deprecated field is itself deprecated. Use Stability instead.","type":"boolean"},"description":{"type":"string"},"displayName":{"type":"string"},"hash":{"description":"Hash is a hex formatted sha256 Hash of the json-encoded spec that is used to determine if the spec has changed.","type":"string"},"icon":{"type":"string"},"id":{"type":"string"},"labels":{"$ref":"#/components/schemas/model.Labels"},"name":{"type":"string"},"resourceDocLink":{"type":"string"},"stability":{"description":"Stability is the stability of the resource, one of development, alpha, beta, stable, or\ndeprecated. This should be used instead of the Deprecated field.","allOf":[{"$ref":"#/components/schemas/model.Stability"}]},"version":{"description":"Version is a 1-based integer that is incremented each time the spec is changed.","type":"integer"},"warning":{"description":"Warning is an optional message that is displayed to the user when the resource is configured. Currently used for IntegrationTypes.","type":"string"}}},"model.AdditionalInfo":{"type":"object","properties":{"documentation":{"type":"array","items":{"$ref":"#/components/schemas/model.DocumentationLink"}},"message":{"type":"string"}}},"model.DocumentationLink":{"type":"object","properties":{"text":{"type":"string"},"url":{"type":"string"}}},"model.Labels":{"type":"object"},"model.Stability":{"type":"string","enum":["development","alpha","beta","stable","deprecated",""]},"model.UserSpec":{"type":"object","properties":{"activeAccount":{"type":"string"},"email":{"type":"string"},"nextLoginAccount":{"type":"string"},"requestedMFA":{"description":"RequestedMFA is true if the user has opted-in for multi-factor authentication. This is only supported when Auth0\nis configured as the authentication type.","type":"boolean"}}},"model.NoStatus":{"type":"object"},"model.ErrorResponse":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"string"}}}}}}}
```

## DELETE /users/{id}

> Delete user by id

```json
{"openapi":"3.1.1","info":{"title":"","version":"0.0.1"},"servers":[{"url":"/v1"}],"paths":{"/users/{id}":{"delete":{"tags":["users"],"summary":"Delete user by id","parameters":[{"schema":{"type":"string"},"description":"the id of the user to delete","name":"id","in":"path","required":true}],"responses":{"204":{"description":"Successful Delete, no content"},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ErrorResponse"}}}}}}}},"components":{"schemas":{"model.ErrorResponse":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"string"}}}}}}}
```
