# Get All agents

**Step1: Prepare Your Request**

* **Endpoint:** `/agent/:projectId`
* **Method:** `GET`
* **URL:** `https://api.talkstackai.com/agent/:projectId`
* **Headers:** Include `Content-Type: application/json`.
* **Authorization:** Bearer token  or x-api-key in headers

**Step2: Setting Request parameters**

* `projectId`: The id of the project from which you want to fetch a list of agents.

```
{
    "projectId": "XXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}
```

**Step 3: Send the Request**

Use your preferred HTTP client to send the GET request with route params.

**Step 4: Handle the request**

The response will show a detailed list of all active agents in the project.

**Success Response:**

* **Status Code:** `200 OK`
* **Body:** The response gives a list of all agents.

```
[
    {
        "name": "John",
        "projectId": "XXXXXXXXXXXXXXXXXXX",
        "systemInstruction": "Instructions given to the agent.".
        "id": "XXXXXXXXXXXXXXXXXXXXXXXX"
    },
    {
        "name": "Jack",
        "projectId": "XXXXXXXXXXXXXXXXXXX",
        "systemInstruction": "Instructions given to the agent.".
        "id": "XXXXXXXXXXXXXXXXXXXXXXXX"
    },
]
```

**Troubleshooting**

* `400 Bad Request`: If the `projectId` is missing in the request.
* `404 Not Found`: If there are no agents.
* `500 Internal Server Error`: For errors in getting the agent list

Last updated 15 hours ago
