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

# get\_\_apikeys

Retrieve a list of provider API keys for a given workspace.

## Request

**Endpoint**: `GET /apikeys`

Retrieves a list of available provider API keys, which can be reused when creating new storage units or configuring AI models. This endpoint requires a valid session token.

### Query Parameters

| Field         | Type   | Required | Description                                                                                                                                  |
| ------------- | ------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `workspaceId` | string | Optional | The unique identifier of the workspace to filter API keys. If omitted, returns API keys across the organization that the user has access to. |

### Request Example

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X GET "https://backend.flashback.tech/apikeys?workspaceId=workspace-uuid" \
  -H "Authorization: Bearer <your-session-token>" \
  -H "Content-Type: application/json"
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const response = await fetch("https://backend.flashback.tech/apikeys?workspaceId=workspace-uuid", {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer <your-session-token>',
    'Content-Type': 'application/json'
  }
});
const data = await response.json();
console.log(data);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://backend.flashback.tech/apikeys"
params = {"workspaceId": "workspace-uuid"}
headers = {
    "Authorization": "Bearer <your-session-token>",
    "Content-Type": "application/json"
}

response = requests.get(url, headers=headers, params=params)
print(response.json())
```

{% endtab %}

{% tab title="Go" %}

```go
import (
	"fmt"
	"io/ioutil"
	"net/http"
)

func main() {
	url := "https://backend.flashback.tech/apikeys?workspaceId=workspace-uuid"
	req, _ := http.NewRequest("GET", url, nil)
	req.Header.Add("Authorization", "Bearer <your-session-token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)
	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(string(body))
}
```

{% endtab %}
{% endtabs %}

***

## Response

### Response Fields (GetProviderApiKeysResponse)

| Field     | Type    | Description                                            |
| --------- | ------- | ------------------------------------------------------ |
| `success` | boolean | Indicates whether the request was successful (`true`). |
| `apiKeys` | array   | A list of API key objects (`ProviderApiKeyDTO`).       |

#### ProviderApiKeyDTO

| Field          | Type                | Description                                                           |
| -------------- | ------------------- | --------------------------------------------------------------------- |
| `id`           | string              | Unique identifier for the API key.                                    |
| `key`          | string              | The public access key or identifier for the provider.                 |
| `endpoint`     | string \| undefined | The endpoint URL of the provider (if applicable).                     |
| `region`       | string \| undefined | The region of the provider (if applicable).                           |
| `provider`     | string              | The name or enum value of the provider (e.g., `AWS`, `GCP`, `AZURE`). |
| `createdAt`    | string              | ISO 8601 timestamp of when the API key was created.                   |
| `bucket_count` | number \| undefined | The total number of active storage units/buckets using this API key.  |
| `aillm_count`  | number \| undefined | The total number of active AI models using this API key.              |

### Response Example (200 OK)

```json
{
  "success": true,
  "apiKeys": [
    {
      "id": "e421a8cd-...",
      "key": "AKIAIOSFODNN7EXAMPLE",
      "endpoint": "s3.us-east-1.amazonaws.com",
      "region": "us-east-1",
      "provider": "AWS",
      "createdAt": "2024-03-08T12:00:00.000Z",
      "bucket_count": 2,
      "aillm_count": 0
    },
    {
      "id": "f8a91b2c-...",
      "key": "some-other-key",
      "provider": "GCP",
      "createdAt": "2024-03-05T08:30:00.000Z",
      "bucket_count": 1,
      "aillm_count": 1
    }
  ]
}
```

***

## Error Responses

### 401 Unauthorized

Returned when the session token is missing, invalid, or the user cannot be validated.

```json
{
  "success": false,
  "message": "User not found or not validated"
}
```

### 403 Forbidden

Returned when the user does not have permission to read buckets or API keys in the specified workspace.

```json
{
  "success": false,
  "message": "Insufficient permissions to read API keys in this workspace"
}
```

### 500 Internal Server Error

Returned when an unexpected server error occurs.

```json
{
  "success": false,
  "apiKeys": [],
  "message": "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.flashback.tech/support-reference/platform-api-reference/api-key-management/get__apikeys.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.
