> For the complete documentation index, see [llms.txt](https://docs.nexos.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nexos.ai/gateway-api/team-management.md).

# Team Management

Manage teams, API keys, and models.

## List teams

> Returns the caller's team, or all teams in the company when the caller is an owner.

```json
{"openapi":"3.0.0","info":{"title":"Nexos AI Public API Production","version":"1.0.0"},"tags":[{"name":"Team Management","description":"Manage teams, API keys, and models."}],"servers":[{"url":"https://api.nexos.ai"}],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"},"apiKeyHeader":{"type":"apiKey","in":"header","name":"X-Api-Key","description":"Authenticate by sending your nexos API key in the `X-Api-Key` header (e.g. `X-Api-Key: user-...` for a user key or `X-Api-Key: team-...` for a team key). This is an alternative to the `Authorization: Bearer` scheme. If both `X-Nexos-Key` and `X-Api-Key` are sent, `X-Nexos-Key` takes precedence."}},"responses":{"TeamListResponse":{"description":"A list of teams.","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Team"}},"total":{"type":"integer"}}}}}},"PermissionDenied":{"description":"Permission denied."}},"schemas":{"Team":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the team."},"name":{"type":"string","description":"The name of the team."},"created_at":{"type":"string","format":"date-time","description":"The time the team was created."},"updated_at":{"type":"string","format":"date-time","description":"The time the team was last updated."},"default_model_id":{"type":"string","description":"Default model to be used for team."},"is_default_team":{"type":"boolean","description":"Default team is created after creating a company. Default team cannot be removed by user."}},"required":["id","name"]}}},"paths":{"/v1/teams":{"get":{"operationId":"list-teams-v1","tags":["Team Management"],"summary":"List teams","description":"Returns the caller's team, or all teams in the company when the caller is an owner.","responses":{"200":{"$ref":"#/components/responses/TeamListResponse"},"403":{"$ref":"#/components/responses/PermissionDenied"}}}}}}
```

## Create a team

> Create a new team in the caller's company. Only owners can create teams.

```json
{"openapi":"3.0.0","info":{"title":"Nexos AI Public API Production","version":"1.0.0"},"tags":[{"name":"Team Management","description":"Manage teams, API keys, and models."}],"servers":[{"url":"https://api.nexos.ai"}],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"},"apiKeyHeader":{"type":"apiKey","in":"header","name":"X-Api-Key","description":"Authenticate by sending your nexos API key in the `X-Api-Key` header (e.g. `X-Api-Key: user-...` for a user key or `X-Api-Key: team-...` for a team key). This is an alternative to the `Authorization: Bearer` scheme. If both `X-Nexos-Key` and `X-Api-Key` are sent, `X-Nexos-Key` takes precedence."}},"schemas":{"TeamRequest":{"type":"object","properties":{"name":{"type":"string","description":"The name of the team."}},"required":["name"]},"Team":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the team."},"name":{"type":"string","description":"The name of the team."},"created_at":{"type":"string","format":"date-time","description":"The time the team was created."},"updated_at":{"type":"string","format":"date-time","description":"The time the team was last updated."},"default_model_id":{"type":"string","description":"Default model to be used for team."},"is_default_team":{"type":"boolean","description":"Default team is created after creating a company. Default team cannot be removed by user."}},"required":["id","name"]}},"responses":{"PermissionDenied":{"description":"Permission denied."}}},"paths":{"/v1/teams":{"post":{"operationId":"create-team-v1","tags":["Team Management"],"summary":"Create a team","description":"Create a new team in the caller's company. Only owners can create teams.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeamRequest"}}}},"responses":{"201":{"description":"Team created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Team"}}}},"400":{"description":"Invalid request data."},"403":{"$ref":"#/components/responses/PermissionDenied"},"409":{"description":"Team with the provided name already exists."}}}}}}
```

## Get a team

> Retrieve a team by ID.

```json
{"openapi":"3.0.0","info":{"title":"Nexos AI Public API Production","version":"1.0.0"},"tags":[{"name":"Team Management","description":"Manage teams, API keys, and models."}],"servers":[{"url":"https://api.nexos.ai"}],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"},"apiKeyHeader":{"type":"apiKey","in":"header","name":"X-Api-Key","description":"Authenticate by sending your nexos API key in the `X-Api-Key` header (e.g. `X-Api-Key: user-...` for a user key or `X-Api-Key: team-...` for a team key). This is an alternative to the `Authorization: Bearer` scheme. If both `X-Nexos-Key` and `X-Api-Key` are sent, `X-Nexos-Key` takes precedence."}},"schemas":{"Team":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the team."},"name":{"type":"string","description":"The name of the team."},"created_at":{"type":"string","format":"date-time","description":"The time the team was created."},"updated_at":{"type":"string","format":"date-time","description":"The time the team was last updated."},"default_model_id":{"type":"string","description":"Default model to be used for team."},"is_default_team":{"type":"boolean","description":"Default team is created after creating a company. Default team cannot be removed by user."}},"required":["id","name"]}},"responses":{"PermissionDenied":{"description":"Permission denied."}}},"paths":{"/v1/teams/{teamId}":{"get":{"operationId":"get-team-v1","tags":["Team Management"],"summary":"Get a team","description":"Retrieve a team by ID.","parameters":[{"name":"teamId","in":"path","required":true,"description":"The ID of the team.","schema":{"type":"string"}}],"responses":{"200":{"description":"Team details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Team"}}}},"403":{"$ref":"#/components/responses/PermissionDenied"},"404":{"description":"Team not found."}}}}}}
```

## Delete a team

> Remove a team by ID.

```json
{"openapi":"3.0.0","info":{"title":"Nexos AI Public API Production","version":"1.0.0"},"tags":[{"name":"Team Management","description":"Manage teams, API keys, and models."}],"servers":[{"url":"https://api.nexos.ai"}],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"},"apiKeyHeader":{"type":"apiKey","in":"header","name":"X-Api-Key","description":"Authenticate by sending your nexos API key in the `X-Api-Key` header (e.g. `X-Api-Key: user-...` for a user key or `X-Api-Key: team-...` for a team key). This is an alternative to the `Authorization: Bearer` scheme. If both `X-Nexos-Key` and `X-Api-Key` are sent, `X-Nexos-Key` takes precedence."}},"responses":{"PermissionDenied":{"description":"Permission denied."}}},"paths":{"/v1/teams/{teamId}":{"delete":{"operationId":"delete-team-v1","tags":["Team Management"],"summary":"Delete a team","description":"Remove a team by ID.","parameters":[{"name":"teamId","in":"path","required":true,"description":"The ID of the team.","schema":{"type":"string"}},{"name":"fallback_team_id","in":"query","required":false,"description":"The ID of the team to transfer users to if the team being deleted has associated users. This parameter is required if the team has users; otherwise, it is ignored. A team_owner caller cannot supply this parameter and receives a 403 if they do.","schema":{"type":"string"}}],"responses":{"204":{"description":"Team deleted."},"400":{"description":"Invalid request data. Returned when the team still has members and no fallback team is provided, or when the provided fallback team belongs to a different company."},"403":{"$ref":"#/components/responses/PermissionDenied"},"404":{"description":"Team not found."},"409":{"description":"Team with API keys cannot be deleted."}}}}}}
```

## Update a team

> Partially update details of an existing team.

```json
{"openapi":"3.0.0","info":{"title":"Nexos AI Public API Production","version":"1.0.0"},"tags":[{"name":"Team Management","description":"Manage teams, API keys, and models."}],"servers":[{"url":"https://api.nexos.ai"}],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"},"apiKeyHeader":{"type":"apiKey","in":"header","name":"X-Api-Key","description":"Authenticate by sending your nexos API key in the `X-Api-Key` header (e.g. `X-Api-Key: user-...` for a user key or `X-Api-Key: team-...` for a team key). This is an alternative to the `Authorization: Bearer` scheme. If both `X-Nexos-Key` and `X-Api-Key` are sent, `X-Nexos-Key` takes precedence."}},"schemas":{"UpdateTeamRequest":{"type":"object","properties":{"name":{"type":"string","description":"The name of the team."},"default_model_id":{"type":"string","description":"Default model to be used for team."}}},"Team":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the team."},"name":{"type":"string","description":"The name of the team."},"created_at":{"type":"string","format":"date-time","description":"The time the team was created."},"updated_at":{"type":"string","format":"date-time","description":"The time the team was last updated."},"default_model_id":{"type":"string","description":"Default model to be used for team."},"is_default_team":{"type":"boolean","description":"Default team is created after creating a company. Default team cannot be removed by user."}},"required":["id","name"]}},"responses":{"PermissionDenied":{"description":"Permission denied."}}},"paths":{"/v1/teams/{teamId}":{"patch":{"operationId":"update-team-v1","tags":["Team Management"],"summary":"Update a team","description":"Partially update details of an existing team.","parameters":[{"name":"teamId","in":"path","required":true,"description":"The ID of the team.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTeamRequest"}}}},"responses":{"200":{"description":"Team updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Team"}}}},"400":{"description":"Invalid request data."},"403":{"$ref":"#/components/responses/PermissionDenied"},"404":{"description":"Team not found, or the default model was not found."},"409":{"description":"Team with the provided name already exists."}}}}}}
```

## List team API keys

> Return all API keys that belong to the team.

```json
{"openapi":"3.0.0","info":{"title":"Nexos AI Public API Production","version":"1.0.0"},"tags":[{"name":"Team Management","description":"Manage teams, API keys, and models."}],"servers":[{"url":"https://api.nexos.ai"}],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"},"apiKeyHeader":{"type":"apiKey","in":"header","name":"X-Api-Key","description":"Authenticate by sending your nexos API key in the `X-Api-Key` header (e.g. `X-Api-Key: user-...` for a user key or `X-Api-Key: team-...` for a team key). This is an alternative to the `Authorization: Bearer` scheme. If both `X-Nexos-Key` and `X-Api-Key` are sent, `X-Nexos-Key` takes precedence."}},"schemas":{"APIKey":{"type":"object","properties":{"api_key":{"type":"string","description":"API Key for use with completions API"},"id":{"type":"string","description":"Unique identifier for the API key"},"name":{"type":"string","description":"Display name for the API key"},"enabled":{"type":"boolean","description":"Whether the API key is enabled."},"removed":{"type":"boolean","description":"Whether the API key has been soft-deleted"},"created_at":{"type":"string","format":"date-time","description":"The time the key was created."},"updated_at":{"type":"string","format":"date-time","description":"The time the key was last updated."},"last_used_at":{"type":"string","format":"date-time","description":"The time the key was last used."},"expiration_date":{"type":"string","format":"date-time","description":"The date when the key expires. Null if the key does not expire."}},"required":["id","api_key","name","enabled","removed"]}}},"paths":{"/v1/teams/{teamId}/api_keys":{"get":{"operationId":"list-team-api-keys-v1","tags":["Team Management"],"summary":"List team API keys","description":"Return all API keys that belong to the team.","parameters":[{"name":"teamId","in":"path","required":true,"description":"The ID of the team.","schema":{"type":"string"}}],"responses":{"200":{"description":"List of team API keys","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/APIKey"}}}}}}}}}}
```

## Create team API key

> Create a new API key for the team.

```json
{"openapi":"3.0.0","info":{"title":"Nexos AI Public API Production","version":"1.0.0"},"tags":[{"name":"Team Management","description":"Manage teams, API keys, and models."}],"servers":[{"url":"https://api.nexos.ai"}],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"},"apiKeyHeader":{"type":"apiKey","in":"header","name":"X-Api-Key","description":"Authenticate by sending your nexos API key in the `X-Api-Key` header (e.g. `X-Api-Key: user-...` for a user key or `X-Api-Key: team-...` for a team key). This is an alternative to the `Authorization: Bearer` scheme. If both `X-Nexos-Key` and `X-Api-Key` are sent, `X-Nexos-Key` takes precedence."}},"schemas":{"APIKeyRequest":{"type":"object","properties":{"name":{"type":"string","description":"The name of the key (needs to be unique).","minLength":1,"maxLength":255},"enabled":{"type":"boolean","description":"Whether the API key is enabled. Only applicable when updating a key."},"expiration_date":{"type":"string","format":"date-time","nullable":true,"description":"The date when the key expires. Null means no expiration."}},"required":["name"]},"APIKey":{"type":"object","properties":{"api_key":{"type":"string","description":"API Key for use with completions API"},"id":{"type":"string","description":"Unique identifier for the API key"},"name":{"type":"string","description":"Display name for the API key"},"enabled":{"type":"boolean","description":"Whether the API key is enabled."},"removed":{"type":"boolean","description":"Whether the API key has been soft-deleted"},"created_at":{"type":"string","format":"date-time","description":"The time the key was created."},"updated_at":{"type":"string","format":"date-time","description":"The time the key was last updated."},"last_used_at":{"type":"string","format":"date-time","description":"The time the key was last used."},"expiration_date":{"type":"string","format":"date-time","description":"The date when the key expires. Null if the key does not expire."}},"required":["id","api_key","name","enabled","removed"]}},"responses":{"TeamAPIKeyResponse":{"description":"Team API Key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIKey"}}}}}},"paths":{"/v1/teams/{teamId}/api_keys":{"post":{"operationId":"create-team-api-key-v1","tags":["Team Management"],"summary":"Create team API key","description":"Create a new API key for the team.","parameters":[{"name":"teamId","in":"path","required":true,"description":"The ID of the team.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIKeyRequest"}}}},"responses":{"201":{"$ref":"#/components/responses/TeamAPIKeyResponse"}}}}}}
```

## Update many team API keys

> Update multiple team API keys in a single request.

```json
{"openapi":"3.0.0","info":{"title":"Nexos AI Public API Production","version":"1.0.0"},"tags":[{"name":"Team Management","description":"Manage teams, API keys, and models."}],"servers":[{"url":"https://api.nexos.ai"}],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"},"apiKeyHeader":{"type":"apiKey","in":"header","name":"X-Api-Key","description":"Authenticate by sending your nexos API key in the `X-Api-Key` header (e.g. `X-Api-Key: user-...` for a user key or `X-Api-Key: team-...` for a team key). This is an alternative to the `Authorization: Bearer` scheme. If both `X-Nexos-Key` and `X-Api-Key` are sent, `X-Nexos-Key` takes precedence."}},"schemas":{"APIKeyBulkUpdateRequest":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/APIKeyBulkUpdateItem"},"maxItems":100}},"required":["items"]},"APIKeyBulkUpdateItem":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"The UUID of the key to update."},"name":{"type":"string","description":"The name of the key.","minLength":1,"maxLength":255},"enabled":{"type":"boolean","description":"Whether the API key is enabled."},"expiration_date":{"type":"string","format":"date-time","nullable":true,"description":"The date when the key expires."},"remove":{"type":"boolean","description":"If you want to remove api key, set this to true - other cases skip."}},"required":["id"]},"APIKey":{"type":"object","properties":{"api_key":{"type":"string","description":"API Key for use with completions API"},"id":{"type":"string","description":"Unique identifier for the API key"},"name":{"type":"string","description":"Display name for the API key"},"enabled":{"type":"boolean","description":"Whether the API key is enabled."},"removed":{"type":"boolean","description":"Whether the API key has been soft-deleted"},"created_at":{"type":"string","format":"date-time","description":"The time the key was created."},"updated_at":{"type":"string","format":"date-time","description":"The time the key was last updated."},"last_used_at":{"type":"string","format":"date-time","description":"The time the key was last used."},"expiration_date":{"type":"string","format":"date-time","description":"The date when the key expires. Null if the key does not expire."}},"required":["id","api_key","name","enabled","removed"]}}},"paths":{"/v1/teams/{teamId}/api_keys/bulk":{"post":{"operationId":"update-many-team-api-keys-v1","tags":["Team Management"],"summary":"Update many team API keys","description":"Update multiple team API keys in a single request.","parameters":[{"name":"teamId","in":"path","required":true,"description":"The ID of the team.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIKeyBulkUpdateRequest"}}}},"responses":{"200":{"description":"Updated API keys","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/APIKey"}}}}}}}}}}
```

## Delete team API key

> Permanently delete a team API key.

```json
{"openapi":"3.0.0","info":{"title":"Nexos AI Public API Production","version":"1.0.0"},"tags":[{"name":"Team Management","description":"Manage teams, API keys, and models."}],"servers":[{"url":"https://api.nexos.ai"}],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"},"apiKeyHeader":{"type":"apiKey","in":"header","name":"X-Api-Key","description":"Authenticate by sending your nexos API key in the `X-Api-Key` header (e.g. `X-Api-Key: user-...` for a user key or `X-Api-Key: team-...` for a team key). This is an alternative to the `Authorization: Bearer` scheme. If both `X-Nexos-Key` and `X-Api-Key` are sent, `X-Nexos-Key` takes precedence."}}},"paths":{"/v1/teams/{teamId}/api_keys/{keyId}":{"delete":{"operationId":"delete-team-api-key-v1","tags":["Team Management"],"summary":"Delete team API key","description":"Permanently delete a team API key.","parameters":[{"name":"teamId","in":"path","required":true,"description":"The ID of the team.","schema":{"type":"string"}},{"name":"keyId","in":"path","required":true,"description":"The ID of the key.","schema":{"type":"string"}}],"responses":{"204":{"description":"API key deleted successfully."},"400":{"description":"Bad request"},"404":{"description":"Team/Key not found."}}}}}}
```

## Update team API key

> Update a team API key.

```json
{"openapi":"3.0.0","info":{"title":"Nexos AI Public API Production","version":"1.0.0"},"tags":[{"name":"Team Management","description":"Manage teams, API keys, and models."}],"servers":[{"url":"https://api.nexos.ai"}],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"},"apiKeyHeader":{"type":"apiKey","in":"header","name":"X-Api-Key","description":"Authenticate by sending your nexos API key in the `X-Api-Key` header (e.g. `X-Api-Key: user-...` for a user key or `X-Api-Key: team-...` for a team key). This is an alternative to the `Authorization: Bearer` scheme. If both `X-Nexos-Key` and `X-Api-Key` are sent, `X-Nexos-Key` takes precedence."}},"schemas":{"APIKeyRequest":{"type":"object","properties":{"name":{"type":"string","description":"The name of the key (needs to be unique).","minLength":1,"maxLength":255},"enabled":{"type":"boolean","description":"Whether the API key is enabled. Only applicable when updating a key."},"expiration_date":{"type":"string","format":"date-time","nullable":true,"description":"The date when the key expires. Null means no expiration."}},"required":["name"]},"APIKey":{"type":"object","properties":{"api_key":{"type":"string","description":"API Key for use with completions API"},"id":{"type":"string","description":"Unique identifier for the API key"},"name":{"type":"string","description":"Display name for the API key"},"enabled":{"type":"boolean","description":"Whether the API key is enabled."},"removed":{"type":"boolean","description":"Whether the API key has been soft-deleted"},"created_at":{"type":"string","format":"date-time","description":"The time the key was created."},"updated_at":{"type":"string","format":"date-time","description":"The time the key was last updated."},"last_used_at":{"type":"string","format":"date-time","description":"The time the key was last used."},"expiration_date":{"type":"string","format":"date-time","description":"The date when the key expires. Null if the key does not expire."}},"required":["id","api_key","name","enabled","removed"]}},"responses":{"TeamAPIKeyResponse":{"description":"Team API Key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIKey"}}}}}},"paths":{"/v1/teams/{teamId}/api_keys/{keyId}":{"patch":{"operationId":"update-team-api-key-v1","tags":["Team Management"],"summary":"Update team API key","description":"Update a team API key.","parameters":[{"name":"teamId","in":"path","required":true,"description":"The ID of the team.","schema":{"type":"string"}},{"name":"keyId","in":"path","required":true,"description":"The ID of the key.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIKeyRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/TeamAPIKeyResponse"},"400":{"description":"Invalid request."},"404":{"description":"Team/Key not found."}}}}}}
```

## Regenerate team API key

> Regenerate the value of a team API key.

```json
{"openapi":"3.0.0","info":{"title":"Nexos AI Public API Production","version":"1.0.0"},"tags":[{"name":"Team Management","description":"Manage teams, API keys, and models."}],"servers":[{"url":"https://api.nexos.ai"}],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"},"apiKeyHeader":{"type":"apiKey","in":"header","name":"X-Api-Key","description":"Authenticate by sending your nexos API key in the `X-Api-Key` header (e.g. `X-Api-Key: user-...` for a user key or `X-Api-Key: team-...` for a team key). This is an alternative to the `Authorization: Bearer` scheme. If both `X-Nexos-Key` and `X-Api-Key` are sent, `X-Nexos-Key` takes precedence."}},"responses":{"TeamAPIKeyResponse":{"description":"Team API Key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIKey"}}}}},"schemas":{"APIKey":{"type":"object","properties":{"api_key":{"type":"string","description":"API Key for use with completions API"},"id":{"type":"string","description":"Unique identifier for the API key"},"name":{"type":"string","description":"Display name for the API key"},"enabled":{"type":"boolean","description":"Whether the API key is enabled."},"removed":{"type":"boolean","description":"Whether the API key has been soft-deleted"},"created_at":{"type":"string","format":"date-time","description":"The time the key was created."},"updated_at":{"type":"string","format":"date-time","description":"The time the key was last updated."},"last_used_at":{"type":"string","format":"date-time","description":"The time the key was last used."},"expiration_date":{"type":"string","format":"date-time","description":"The date when the key expires. Null if the key does not expire."}},"required":["id","api_key","name","enabled","removed"]}}},"paths":{"/v1/teams/{teamId}/api_keys/{keyId}/regenerate":{"patch":{"operationId":"regenerate-team-api-key-v1","deprecated":true,"tags":["Team Management"],"summary":"Regenerate team API key","description":"Regenerate the value of a team API key.","parameters":[{"name":"teamId","in":"path","required":true,"description":"The ID of the team.","schema":{"type":"string"}},{"name":"keyId","in":"path","required":true,"description":"The ID of the key.","schema":{"type":"string"}}],"responses":{"200":{"$ref":"#/components/responses/TeamAPIKeyResponse"},"400":{"description":"Invalid request."},"404":{"description":"Team/Key not found."}}}}}}
```

## Rotate API key

> Rotates the API key used to authenticate this request. Returns a new key value.

```json
{"openapi":"3.0.0","info":{"title":"Nexos AI Public API Production","version":"1.0.0"},"tags":[{"name":"Team Management","description":"Manage teams, API keys, and models."},{"name":"User Management","description":"Manage user API keys."}],"servers":[{"url":"https://api.nexos.ai"}],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"},"apiKeyHeader":{"type":"apiKey","in":"header","name":"X-Api-Key","description":"Authenticate by sending your nexos API key in the `X-Api-Key` header (e.g. `X-Api-Key: user-...` for a user key or `X-Api-Key: team-...` for a team key). This is an alternative to the `Authorization: Bearer` scheme. If both `X-Nexos-Key` and `X-Api-Key` are sent, `X-Nexos-Key` takes precedence."}},"responses":{"RotateAPIKeyResponse":{"description":"Rotated API Key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIKey"}}}}},"schemas":{"APIKey":{"type":"object","properties":{"api_key":{"type":"string","description":"API Key for use with completions API"},"id":{"type":"string","description":"Unique identifier for the API key"},"name":{"type":"string","description":"Display name for the API key"},"enabled":{"type":"boolean","description":"Whether the API key is enabled."},"removed":{"type":"boolean","description":"Whether the API key has been soft-deleted"},"created_at":{"type":"string","format":"date-time","description":"The time the key was created."},"updated_at":{"type":"string","format":"date-time","description":"The time the key was last updated."},"last_used_at":{"type":"string","format":"date-time","description":"The time the key was last used."},"expiration_date":{"type":"string","format":"date-time","description":"The date when the key expires. Null if the key does not expire."}},"required":["id","api_key","name","enabled","removed"]}}},"paths":{"/v1/apikey/rotate":{"patch":{"operationId":"rotate-api-key-v1","tags":["Team Management","User Management"],"summary":"Rotate API key","description":"Rotates the API key used to authenticate this request. Returns a new key value.","responses":{"200":{"$ref":"#/components/responses/RotateAPIKeyResponse"},"401":{"description":"Unauthorized — request not authenticated via API key."},"500":{"description":"Internal server error."}}}}}}
```


---

# 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.nexos.ai/gateway-api/team-management.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.
