> 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/company-management.md).

# Company Management

List company API keys and their usage.

## List all company API keys with last usage time

> Returns all API keys (user and team) for the company with pagination and sorting.

```json
{"openapi":"3.0.0","info":{"title":"Nexos AI Public API Production","version":"1.0.0"},"tags":[{"name":"Company Management","description":"List company API keys and their usage."}],"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: nexos-...` for a user key or `X-Api-Key: nexos-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":{"CompanyAPIKeysResponse":{"description":"Paginated list of all API keys for the company","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/CompanyAPIKey"}},"total":{"type":"integer","format":"int64"}}}}}}},"schemas":{"CompanyAPIKey":{"type":"object","properties":{"uuid":{"type":"string","description":"UUID of the API key."},"name":{"type":"string","description":"Name of the API key."},"api_key":{"type":"string","description":"Masked API key value."},"key_owner":{"type":"string","description":"Display name of the key owner (user name or team name)."},"owner_uuid":{"type":"string","description":"UUID of the key owner (user UUID or team UUID)."},"last_used_at":{"type":"string","format":"date-time","description":"Last time the key was used."},"status":{"type":"string","description":"Status of the API key.","enum":["active","disabled","removed","user_deleted","team_deleted","budget_exceeded"]},"type":{"type":"string","description":"Type of the API key owner.","enum":["user","team"]},"budget_used":{"type":"number","format":"float","description":"Current budget used for the owner."},"budget_limit":{"type":"number","format":"float","description":"Budget limit set for the owner, if any."}},"required":["uuid","name","api_key","key_owner","status","type","owner_uuid"]}}},"paths":{"/v1/companies/{companyId}/api_keys/with_usage":{"get":{"operationId":"get-company-api-keys-with-usage-v1","tags":["Company Management"],"summary":"List all company API keys with last usage time","description":"Returns all API keys (user and team) for the company with pagination and sorting.","parameters":[{"name":"companyId","in":"path","required":true,"description":"The UUID of the company.","schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"description":"Number of records per page.","schema":{"type":"integer","format":"int32"}},{"name":"offset","in":"query","required":false,"description":"Number of records to skip.","schema":{"type":"integer","format":"int32","minimum":0}},{"name":"sort_by_field","in":"query","required":false,"description":"Sort field: name, key_owner, last_used_at, status.","schema":{"type":"string","enum":["name","key_owner","budget_used","budget_limit","status","last_used_at"]}},{"name":"sort_by_order","in":"query","required":false,"description":"Sort order: asc, desc.","schema":{"type":"string","enum":["asc","desc"]}},{"name":"name","in":"query","required":false,"description":"Filter by API key name (partial match).","schema":{"type":"string"}},{"name":"owner_uuid","in":"query","required":false,"description":"Filter by owner UUID (user or team).","schema":{"type":"string"}}],"responses":{"200":{"$ref":"#/components/responses/CompanyAPIKeysResponse"}}}}}}
```

## List company user API keys aggregated by owner

> Returns the company's user API keys aggregated by owner, with usage and budget information.

```json
{"openapi":"3.0.0","info":{"title":"Nexos AI Public API Production","version":"1.0.0"},"tags":[{"name":"Company Management","description":"List company API keys and their usage."}],"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: nexos-...` for a user key or `X-Api-Key: nexos-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":{"UserAPIKeyOwnersResponse":{"description":"Paginated list of user API key owners with keys count","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/UserAPIKeyOwner"}},"total":{"type":"integer","format":"int64"}}}}}}},"schemas":{"UserAPIKeyOwner":{"type":"object","properties":{"owner_uuid":{"type":"string","description":"UUID of the owner (user)."},"owner_name":{"type":"string","description":"Display name of the owner."},"key_count":{"type":"integer","format":"int64","description":"Number of API keys belonging to this owner."},"status":{"type":"string","description":"Dynamic status of the API key owner.","enum":["active","disabled","removed","user_deleted","team_deleted","budget_exceeded"]},"budget_used":{"type":"number","format":"float","description":"Current budget used for the user."},"budget_limit":{"type":"number","format":"float","description":"Budget limit set for the user, if any."}},"required":["owner_uuid","owner_name","key_count","status"]}}},"paths":{"/v1/companies/{companyId}/users/api_keys/with_usage":{"get":{"operationId":"get-company-user-api-keys-with-usage-v1","tags":["Company Management"],"summary":"List company user API keys aggregated by owner","description":"Returns the company's user API keys aggregated by owner, with usage and budget information.","parameters":[{"name":"companyId","in":"path","required":true,"description":"The UUID of the company.","schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"description":"Maximum number of items to return.","schema":{"type":"integer","format":"int32","minimum":1}},{"name":"offset","in":"query","required":false,"description":"Number of items to skip.","schema":{"type":"integer","format":"int32","minimum":0}},{"name":"sort_by_field","in":"query","required":false,"description":"Field to sort by: owner_name, status, key_count, budget_used, budget_limit.","schema":{"type":"string","enum":["owner_name","key_count","budget_used","budget_limit"]}},{"name":"sort_by_order","in":"query","required":false,"description":"Sort order: asc, desc.","schema":{"type":"string","enum":["asc","desc"]}},{"name":"owner_name","in":"query","required":false,"description":"Filter by owner name (partial match).","schema":{"type":"string"}}],"responses":{"200":{"$ref":"#/components/responses/UserAPIKeyOwnersResponse"}}}}}}
```

## List user API keys with last usage time

> Returns all API keys of a specific user in the company, with last usage time.

```json
{"openapi":"3.0.0","info":{"title":"Nexos AI Public API Production","version":"1.0.0"},"tags":[{"name":"Company Management","description":"List company API keys and their usage."}],"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: nexos-...` for a user key or `X-Api-Key: nexos-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":{"UserAPIKeysWithUsageResponse":{"description":"Paginated list of user API keys with usage","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/APIKeyWithOwner"}},"total":{"type":"integer","format":"int64"}}}}}}},"schemas":{"APIKeyWithOwner":{"allOf":[{"$ref":"#/components/schemas/APIKey"},{"type":"object","properties":{"owner_uuid":{"type":"string","description":"UUID of the owner (user or team)."},"owner_name":{"type":"string","description":"Display name of the owner."},"last_used_at":{"type":"string","format":"date-time","description":"The time the key was last used. Null if the key has never been used."},"removed":{"type":"boolean","description":"Whether the API key owner has been removed."},"status":{"type":"string","description":"Dynamic status of the API key.","enum":["active","disabled","removed","user_deleted","team_deleted","budget_exceeded"]},"budget_used":{"type":"number","format":"float","description":"Current budget used for the key owner."},"budget_limit":{"type":"number","format":"float","description":"Budget limit set for the user, if any."}},"required":["owner_uuid","owner_name","status"]}]},"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/companies/{companyId}/users/{userId}/api_keys/with_usage":{"get":{"operationId":"list-user-api-keys-with-usage-v1","tags":["Company Management"],"summary":"List user API keys with last usage time","description":"Returns all API keys of a specific user in the company, with last usage time.","parameters":[{"name":"companyId","in":"path","required":true,"description":"The UUID of the company.","schema":{"type":"string"}},{"name":"userId","in":"path","required":true,"description":"The UUID of the user.","schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"description":"Maximum number of items to return.","schema":{"type":"integer","format":"int32","minimum":1}},{"name":"offset","in":"query","required":false,"description":"Number of items to skip.","schema":{"type":"integer","format":"int32","minimum":0}},{"name":"name","in":"query","required":false,"description":"Filter by API key name (partial match).","schema":{"type":"string"}},{"name":"sort_by_field","in":"query","required":false,"description":"Field to sort by: name, owner_name, last_used_at, status, budget_limit, budget_used.","schema":{"type":"string","enum":["name","last_used_at","owner_name","status"]}},{"name":"sort_by_order","in":"query","required":false,"description":"Sort order: asc, desc.","schema":{"type":"string","enum":["asc","desc"]}}],"responses":{"200":{"$ref":"#/components/responses/UserAPIKeysWithUsageResponse"}}}}}}
```

## List company team API keys aggregated by team

> Returns the company's team API keys aggregated by team, with usage and budget information.

```json
{"openapi":"3.0.0","info":{"title":"Nexos AI Public API Production","version":"1.0.0"},"tags":[{"name":"Company Management","description":"List company API keys and their usage."}],"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: nexos-...` for a user key or `X-Api-Key: nexos-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":{"TeamAPIKeyOwnersResponse":{"description":"Paginated list of team API key owners with keys count","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/TeamAPIKeyOwner"}},"total":{"type":"integer","format":"int64"}}}}}}},"schemas":{"TeamAPIKeyOwner":{"type":"object","properties":{"owners":{"type":"array","items":{"$ref":"#/components/schemas/APIKeyOwnerInfo"},"description":"List of team members associated with the key group."},"key_count":{"type":"integer","format":"int64","description":"Number of API keys belonging to this team."},"team_uuid":{"type":"string","description":"UUID of the team."},"team_name":{"type":"string","description":"Name of the team."},"status":{"type":"string","description":"Dynamic status of the API key owner.","enum":["active","disabled","removed","user_deleted","team_deleted","budget_exceeded"]},"budget_used":{"type":"number","format":"float","description":"Current budget used for the team."},"budget_limit":{"type":"number","format":"float","description":"Budget limit set for the team, if any."}},"required":["owners","key_count","status"]},"APIKeyOwnerInfo":{"type":"object","properties":{"owner_uuid":{"type":"string","description":"UUID of the owner (user)."},"owner_name":{"type":"string","description":"Display name of the owner."}},"required":["owner_uuid","owner_name"]}}},"paths":{"/v1/companies/{companyId}/teams/api_keys/with_usage":{"get":{"operationId":"get-company-team-api-keys-with-usage-v1","tags":["Company Management"],"summary":"List company team API keys aggregated by team","description":"Returns the company's team API keys aggregated by team, with usage and budget information.","parameters":[{"name":"companyId","in":"path","required":true,"description":"The UUID of the company.","schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"description":"Maximum number of items to return.","schema":{"type":"integer","format":"int32","minimum":1}},{"name":"offset","in":"query","required":false,"description":"Number of items to skip.","schema":{"type":"integer","format":"int32","minimum":0}},{"name":"sort_by_field","in":"query","required":false,"description":"Field to sort by: team_name, status, key_count, budget_used, budget_limit.","schema":{"type":"string","enum":["team_name","key_count","budget_used","budget_limit"]}},{"name":"sort_by_order","in":"query","required":false,"description":"Sort order: asc, desc.","schema":{"type":"string","enum":["asc","desc"]}},{"name":"team_name","in":"query","required":false,"description":"Filter by team name (partial match).","schema":{"type":"string"}}],"responses":{"200":{"$ref":"#/components/responses/TeamAPIKeyOwnersResponse"}}}}}}
```

## List team API keys with last usage time

> Returns all API keys of a specific team in the company, with last usage time.

```json
{"openapi":"3.0.0","info":{"title":"Nexos AI Public API Production","version":"1.0.0"},"tags":[{"name":"Company Management","description":"List company API keys and their usage."}],"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: nexos-...` for a user key or `X-Api-Key: nexos-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":{"TeamAPIKeysWithUsageResponse":{"description":"Paginated list of team API keys with usage","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/APIKeyWithOwner"}},"total":{"type":"integer","format":"int64"}}}}}}},"schemas":{"APIKeyWithOwner":{"allOf":[{"$ref":"#/components/schemas/APIKey"},{"type":"object","properties":{"owner_uuid":{"type":"string","description":"UUID of the owner (user or team)."},"owner_name":{"type":"string","description":"Display name of the owner."},"last_used_at":{"type":"string","format":"date-time","description":"The time the key was last used. Null if the key has never been used."},"removed":{"type":"boolean","description":"Whether the API key owner has been removed."},"status":{"type":"string","description":"Dynamic status of the API key.","enum":["active","disabled","removed","user_deleted","team_deleted","budget_exceeded"]},"budget_used":{"type":"number","format":"float","description":"Current budget used for the key owner."},"budget_limit":{"type":"number","format":"float","description":"Budget limit set for the user, if any."}},"required":["owner_uuid","owner_name","status"]}]},"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/companies/{companyId}/teams/{teamId}/api_keys/with_usage":{"get":{"operationId":"list-team-api-keys-with-usage-v1","tags":["Company Management"],"summary":"List team API keys with last usage time","description":"Returns all API keys of a specific team in the company, with last usage time.","parameters":[{"name":"companyId","in":"path","required":true,"description":"The UUID of the company.","schema":{"type":"string"}},{"name":"teamId","in":"path","required":true,"description":"The UUID of the team.","schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"description":"Maximum number of items to return.","schema":{"type":"integer","format":"int32","minimum":1}},{"name":"offset","in":"query","required":false,"description":"Number of items to skip.","schema":{"type":"integer","format":"int32","minimum":0}},{"name":"name","in":"query","required":false,"description":"Filter by API key name (partial match).","schema":{"type":"string"}},{"name":"sort_by_field","in":"query","required":false,"description":"Field to sort by: name, owner_name, last_used_at.","schema":{"type":"string","enum":["name","last_used_at","owner_name"]}},{"name":"sort_by_order","in":"query","required":false,"description":"Sort order: asc, desc.","schema":{"type":"string","enum":["asc","desc"]}}],"responses":{"200":{"$ref":"#/components/responses/TeamAPIKeysWithUsageResponse"}}}}}}
```


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.nexos.ai/gateway-api/company-management.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
