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

# Environments

## GET /api/v1/environments

> List all Environments

```json
{"openapi":"3.1.1","info":{"title":"Frends API","version":"1.0.0"},"tags":[{"name":"Environments"}],"servers":[{"url":"https://example.v64.frendsapp.com/"}],"security":[{}],"paths":{"/api/v1/environments":{"get":{"tags":["Environments"],"summary":"List all Environments","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseOfIListOfDtoEnvironmentGet"}}}}}}}},"components":{"schemas":{"ResponseOfIListOfDtoEnvironmentGet":{"required":["data"],"type":"object","properties":{"data":{"type":["null","array"],"items":{"$ref":"#/components/schemas/DtoEnvironmentGet"},"description":"Response data"}}},"DtoEnvironmentGet":{"type":"object","properties":{"agentGroups":{"type":["null","array"],"items":{"$ref":"#/components/schemas/DtoAgentGroupGet"},"description":"The Agent Groups that belong to the Environment"},"internalName":{"type":["null","string"],"description":"Internal name used by Frends for the Environment"},"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"description":"Unique identifier for the Environment","format":"int64"},"displayName":{"type":["null","string"],"description":"Display name for the Environment"}}},"DtoAgentGroupGet":{"type":"object","properties":{"internalName":{"type":["null","string"],"description":"Internal name used by Frends for the Agent Group"},"agents":{"type":["null","array"],"items":{"type":"string"},"description":"The Agents that belong to the Agent Group"},"environment":{"description":"The Environment to which the Agent Group belongs","$ref":"#/components/schemas/DtoEnvironmentBase"},"agentDetails":{"type":["null","array"],"items":{"$ref":"#/components/schemas/DtoAgentGet"},"description":"Details about the Agents that belong to the Agent Group"},"agentRegistrationMode":{"description":"The registration mode that determines the lifecycle policy for agents in this group","$ref":"#/components/schemas/AgentRegistrationMode"},"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"description":"Unique identifier for the Agent Group","format":"int64"},"displayName":{"type":["null","string"],"description":"Display name for the Agent Group"}}},"DtoEnvironmentBase":{"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"description":"Unique identifier for the Environment","format":"int64"},"displayName":{"type":["null","string"],"description":"Display name for the Environment"}}},"DtoAgentGet":{"type":"object","properties":{"url":{"type":["null","string"],"description":"The hostname or address for the agent. Can either be full URL https://example.org:1234 or hostname subdomain.example.org"},"httpPorts":{"type":["null","array"],"items":{"type":"string"},"description":"List of http ports the Agent listens to. If the Url is a full address (schema://hostname:port?) this can be ignored."},"httpsPorts":{"type":["null","array"],"items":{"type":"string"},"description":"List of https ports the Agent listens to. If the Url is a full address (schema://hostname:port?) this can be ignored."},"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"description":"Agent Identifier","format":"int64"},"name":{"type":["null","string"],"description":"Agent name"},"isGateway":{"type":"boolean","description":"If the agent is a Gateway Agent. If true, these Agents are the ones that should primarily be accessible from the internet."},"isCloudAgent":{"type":"boolean","description":"If the agent is a Cloud Agent. If true, the agent is managed by Frends."}}},"AgentRegistrationMode":{"enum":["SelfHosted","Deployment","Cloud","StatefulSet"]}}}}
```

## GET /api/v1/environments/{environmentId}

> Get single Environment

```json
{"openapi":"3.1.1","info":{"title":"Frends API","version":"1.0.0"},"tags":[{"name":"Environments"}],"servers":[{"url":"https://example.v64.frendsapp.com/"}],"security":[{}],"paths":{"/api/v1/environments/{environmentId}":{"get":{"tags":["Environments"],"summary":"Get single Environment","parameters":[{"name":"environmentId","in":"path","description":"Environment Identifier","required":true,"schema":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":"integer","format":"int64"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseOfDtoEnvironmentGet"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}}},"components":{"schemas":{"ResponseOfDtoEnvironmentGet":{"required":["data"],"type":"object","properties":{"data":{"oneOf":[{"type":"null"},{"description":"Response data","$ref":"#/components/schemas/DtoEnvironmentGet"}]}}},"DtoEnvironmentGet":{"type":"object","properties":{"agentGroups":{"type":["null","array"],"items":{"$ref":"#/components/schemas/DtoAgentGroupGet"},"description":"The Agent Groups that belong to the Environment"},"internalName":{"type":["null","string"],"description":"Internal name used by Frends for the Environment"},"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"description":"Unique identifier for the Environment","format":"int64"},"displayName":{"type":["null","string"],"description":"Display name for the Environment"}}},"DtoAgentGroupGet":{"type":"object","properties":{"internalName":{"type":["null","string"],"description":"Internal name used by Frends for the Agent Group"},"agents":{"type":["null","array"],"items":{"type":"string"},"description":"The Agents that belong to the Agent Group"},"environment":{"description":"The Environment to which the Agent Group belongs","$ref":"#/components/schemas/DtoEnvironmentBase"},"agentDetails":{"type":["null","array"],"items":{"$ref":"#/components/schemas/DtoAgentGet"},"description":"Details about the Agents that belong to the Agent Group"},"agentRegistrationMode":{"description":"The registration mode that determines the lifecycle policy for agents in this group","$ref":"#/components/schemas/AgentRegistrationMode"},"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"description":"Unique identifier for the Agent Group","format":"int64"},"displayName":{"type":["null","string"],"description":"Display name for the Agent Group"}}},"DtoEnvironmentBase":{"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"description":"Unique identifier for the Environment","format":"int64"},"displayName":{"type":["null","string"],"description":"Display name for the Environment"}}},"DtoAgentGet":{"type":"object","properties":{"url":{"type":["null","string"],"description":"The hostname or address for the agent. Can either be full URL https://example.org:1234 or hostname subdomain.example.org"},"httpPorts":{"type":["null","array"],"items":{"type":"string"},"description":"List of http ports the Agent listens to. If the Url is a full address (schema://hostname:port?) this can be ignored."},"httpsPorts":{"type":["null","array"],"items":{"type":"string"},"description":"List of https ports the Agent listens to. If the Url is a full address (schema://hostname:port?) this can be ignored."},"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"description":"Agent Identifier","format":"int64"},"name":{"type":["null","string"],"description":"Agent name"},"isGateway":{"type":"boolean","description":"If the agent is a Gateway Agent. If true, these Agents are the ones that should primarily be accessible from the internet."},"isCloudAgent":{"type":"boolean","description":"If the agent is a Cloud Agent. If true, the agent is managed by Frends."}}},"AgentRegistrationMode":{"enum":["SelfHosted","Deployment","Cloud","StatefulSet"]},"ProblemDetails":{"type":"object","properties":{"type":{"type":["null","string"]},"title":{"type":["null","string"]},"status":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"format":"int32"},"detail":{"type":["null","string"]},"instance":{"type":["null","string"]}}}}}}
```

## GET /api/v1/environments/{environmentId}/agent-groups

> List Agent Groups for Environment

```json
{"openapi":"3.1.1","info":{"title":"Frends API","version":"1.0.0"},"tags":[{"name":"Environments"}],"servers":[{"url":"https://example.v64.frendsapp.com/"}],"security":[{}],"paths":{"/api/v1/environments/{environmentId}/agent-groups":{"get":{"tags":["Environments"],"summary":"List Agent Groups for Environment","parameters":[{"name":"environmentId","in":"path","description":"Environment Identifier","required":true,"schema":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":"integer","format":"int64"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseOfIListOfDtoAgentGroupGet"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}}},"components":{"schemas":{"ResponseOfIListOfDtoAgentGroupGet":{"required":["data"],"type":"object","properties":{"data":{"type":["null","array"],"items":{"$ref":"#/components/schemas/DtoAgentGroupGet"},"description":"Response data"}}},"DtoAgentGroupGet":{"type":"object","properties":{"internalName":{"type":["null","string"],"description":"Internal name used by Frends for the Agent Group"},"agents":{"type":["null","array"],"items":{"type":"string"},"description":"The Agents that belong to the Agent Group"},"environment":{"description":"The Environment to which the Agent Group belongs","$ref":"#/components/schemas/DtoEnvironmentBase"},"agentDetails":{"type":["null","array"],"items":{"$ref":"#/components/schemas/DtoAgentGet"},"description":"Details about the Agents that belong to the Agent Group"},"agentRegistrationMode":{"description":"The registration mode that determines the lifecycle policy for agents in this group","$ref":"#/components/schemas/AgentRegistrationMode"},"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"description":"Unique identifier for the Agent Group","format":"int64"},"displayName":{"type":["null","string"],"description":"Display name for the Agent Group"}}},"DtoEnvironmentBase":{"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"description":"Unique identifier for the Environment","format":"int64"},"displayName":{"type":["null","string"],"description":"Display name for the Environment"}}},"DtoAgentGet":{"type":"object","properties":{"url":{"type":["null","string"],"description":"The hostname or address for the agent. Can either be full URL https://example.org:1234 or hostname subdomain.example.org"},"httpPorts":{"type":["null","array"],"items":{"type":"string"},"description":"List of http ports the Agent listens to. If the Url is a full address (schema://hostname:port?) this can be ignored."},"httpsPorts":{"type":["null","array"],"items":{"type":"string"},"description":"List of https ports the Agent listens to. If the Url is a full address (schema://hostname:port?) this can be ignored."},"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"description":"Agent Identifier","format":"int64"},"name":{"type":["null","string"],"description":"Agent name"},"isGateway":{"type":"boolean","description":"If the agent is a Gateway Agent. If true, these Agents are the ones that should primarily be accessible from the internet."},"isCloudAgent":{"type":"boolean","description":"If the agent is a Cloud Agent. If true, the agent is managed by Frends."}}},"AgentRegistrationMode":{"enum":["SelfHosted","Deployment","Cloud","StatefulSet"]},"ProblemDetails":{"type":"object","properties":{"type":{"type":["null","string"]},"title":{"type":["null","string"]},"status":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"format":"int32"},"detail":{"type":["null","string"]},"instance":{"type":["null","string"]}}}}}}
```


---

# 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.frends.com/reference/frends-platform-api/platform-api-reference/environments.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.
