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

# put\_\_apikeys\_{uuid}

Update an existing provider API key in your workspace.

## Request

**Endpoint**: `PUT /apikeys/:uuid`

Updates the properties of an existing API key identified by its UUID. Only fields that are provided in the payload will be modified.

### Path Parameters

| Field  | Type   | Required | Description                                     |
| ------ | ------ | -------- | ----------------------------------------------- |
| `uuid` | string | Yes      | The unique identifier of the API key to update. |

### Request Body (UpdateProviderApiKeyRequest)

| Field      | Type                | Required | Description                                                                  |
| ---------- | ------------------- | -------- | ---------------------------------------------------------------------------- |
| `key`      | string              | Optional | The updated public key, identifier, or email.                                |
| `secret`   | string              | Optional | The updated private key or secret password. This is encrypted before saving. |
| `provider` | string              | Optional | The updated provider type enum (e.g., `AWS`, `GCP`, `AZURE`).                |
| `endpoint` | string \| undefined | Optional | The updated custom endpoint URL.                                             |
| `region`   | string \| undefined | Optional | The updated geographical region.                                             |

### Request Example

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

```bash
curl -X PUT "https://backend.flashback.tech/apikeys/your-api-key-uuid" \
  -H "Authorization: Bearer <your-session-token>" \
  -H "Content-Type: application/json" \
  -d '{
    "endpoint": "s3.us-west-2.amazonaws.com",
    "region": "us-west-2"
  }'
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const response = await fetch("https://backend.flashback.tech/apikeys/your-api-key-uuid", {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer <your-session-token>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    endpoint: "s3.us-west-2.amazonaws.com",
    region: "us-west-2"
  })
});
const data = await response.json();
console.log(data);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://backend.flashback.tech/apikeys/your-api-key-uuid"
headers = {
    "Authorization": "Bearer <your-session-token>",
    "Content-Type": "application/json"
}
payload = {
    "endpoint": "s3.us-west-2.amazonaws.com",
    "region": "us-west-2"
}

response = requests.put(url, headers=headers, json=payload)
print(response.json())
```

{% endtab %}

{% tab title="Go" %}

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

func main() {
	url := "https://backend.flashback.tech/apikeys/your-api-key-uuid"
	payload := []byte(`{
		"endpoint": "s3.us-west-2.amazonaws.com",
		"region": "us-west-2"
	}`)

	req, _ := http.NewRequest("PUT", url, bytes.NewBuffer(payload))
	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 (UpdateProviderApiKeyResponse)

| Field     | Type    | Description                                           |
| --------- | ------- | ----------------------------------------------------- |
| `success` | boolean | Indicates whether the update was successful (`true`). |

### Response Example (200 OK)

```json
{
  "success": true
}
```

***

## Error Responses

### 400 Bad Request

Returned when the updated fields conflict with another existing API key in the workspace.

```json
{
  "success": false,
  "message": "API key with these credentials already exists"
}
```

### 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 write access to the workspace where the API key resides.

```json
{
  "success": false,
  "message": "Insufficient permissions"
}
```

### 404 Not Found

Returned if no API key exists with the provided `uuid` inside the user's organization.

```json
{
  "success": false,
  "message": "API key not found"
}
```

### 500 Internal Server Error

Returned when an unexpected server error occurs.

```json
{
  "success": false,
  "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/put__apikeys_uuid.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.
