> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://www.agentmail.to/docs/llms.txt.

# Update Inbox Credential

PATCH https://api.agentmail.to/v0/inboxes/{inbox_id}/credentials/{credential_id}
Content-Type: application/json

Reference: https://agentmail.to/docs/api-reference/inboxes/credentials/update

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Servers

- `https://api.agentmail.to` (prod, default)
- `https://x402.api.agentmail.to` (prod-x402)
- `https://mpp.api.agentmail.to` (prod-mpp)
- `https://api.agentmail.eu` (eu-prod)

## Request

### Path parameters

- `inbox_id` (string, required) — The ID of the inbox.
- `credential_id` (string, required)

### Body (application/json)

This endpoint expects an UpdateCredentialRequest.

- `name` (string, optional, nullable)
- `user` (UpdateCredentialUser, optional)
- `rp` (UpdateCredentialRp, optional)
- `totp` (UpdateCredentialTotp, optional)
- `expires_at` (datetime, optional, nullable)

## Response

### 200

- `created_at` (datetime, required)
- `credential_id` (string, required)
- `organization_id` (string, required) — ID of organization.
- `type` (enum, required)
  - Allowed values: `password`, `totp`, `secret`, `signing_key`, `passkey`, `api_key`
- `updated_at` (datetime, required)
- `version` (integer, required)
- `auth` (ApiKeyAuth, optional)
- `client_id` (string, optional)
- `expires_at` (datetime, optional)
- `inbox_id` (string, optional)
- `last_used_at` (datetime, optional)
- `name` (string, optional)
- `origin` (string, optional)
- `pod_id` (string, optional)
- `public_key` (CredentialPublicKey, optional)
- `rp` (CredentialRp, optional)
- `totp` (TotpSettings, optional)
- `use_count` (integer, optional)
- `user` (CredentialUser, optional)

## Errors

### 400 Validation Error

- `name` (string, required) — Name of error.
- `errors` (any, required) — Validation errors. Each entry has a path and a message identifying the invalid field.
- `code` (string, optional) — Stable, machine-readable error code in snake_case (for example, not_found or missing_permission). Branch on this rather than the message text.
- `message` (string, optional) — Error message.
- `fix` (string, optional) — The concrete next action that resolves the error.
- `docs` (string, optional) — Link to the error reference entry for this code.

### 403 Credential Forbidden Error

- `name` (string, required) — Name of error.
- `message` (string, required) — Error message.
- `code` (string, optional) — Stable, machine-readable error code in snake_case (for example, not_found or missing_permission). Branch on this rather than the message text.
- `fix` (string, optional) — The concrete next action that resolves the error.
- `docs` (string, optional) — Link to the error reference entry for this code.

### 404 Not Found Error

- `name` (string, required) — Name of error.
- `message` (string, required) — Error message.
- `code` (string, optional) — Stable, machine-readable error code in snake_case (for example, not_found or missing_permission). Branch on this rather than the message text.
- `fix` (string, optional) — The concrete next action that resolves the error.
- `docs` (string, optional) — Link to the error reference entry for this code.

### 409 Conflict Error

- `name` (string, required) — Name of error.
- `message` (string, required) — Error message.
- `code` (string, optional) — Stable, machine-readable error code in snake_case (for example, not_found or missing_permission). Branch on this rather than the message text.
- `fix` (string, optional) — The concrete next action that resolves the error.
- `docs` (string, optional) — Link to the error reference entry for this code.

## Types

### UpdateCredentialUser

- `name` (string, optional, nullable)
- `display_name` (string, optional, nullable)

### UpdateCredentialRp

- `name` (string, optional, nullable)

### UpdateCredentialTotp

- `issuer` (string, optional, nullable)

### ApiKeyAuth

- `in`: `header`
  - `name` (string, required)
  - `prefix` (string, optional)
- `in`: `query`
  - `name` (string, required)

### CredentialPublicKey

- `algorithm` (string, required)
- `jwk` (map from string to any, required)
- `webauthn_id` (string, optional)

### CredentialRp

- `id` (string, required)
- `name` (string, optional)

### TotpSettings

- `algorithm` (enum, optional)
  - Allowed values: `SHA1`, `SHA256`, `SHA512`
- `digits` (integer, optional)
- `period` (integer, optional)
- `issuer` (string, optional)

### CredentialUser

- `id` (string, optional)
- `name` (string, optional)
- `display_name` (string, optional)

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "created_at": "2024-01-15T09:30:00Z",
  "credential_id": "credential_id",
  "organization_id": "organization_id",
  "type": "password",
  "updated_at": "2024-01-15T09:30:00Z",
  "version": 1,
  "auth": {
    "in": "header",
    "name": "name",
    "prefix": "prefix"
  },
  "client_id": "client_id",
  "expires_at": "2024-01-15T09:30:00Z",
  "inbox_id": "inbox_id",
  "last_used_at": "2024-01-15T09:30:00Z",
  "name": "name",
  "origin": "origin",
  "pod_id": "pod_id",
  "public_key": {
    "algorithm": "algorithm",
    "jwk": {
      "jwk": {
        "key": "value"
      }
    },
    "webauthn_id": "webauthn_id"
  },
  "rp": {
    "id": "id",
    "name": "name"
  },
  "totp": {
    "algorithm": "SHA1",
    "digits": 1,
    "period": 1,
    "issuer": "issuer"
  },
  "use_count": 1,
  "user": {
    "id": "id",
    "name": "name",
    "display_name": "display_name"
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.agentmail.to/v0/inboxes/inbox_id/credentials/credential_id"

payload = {}
headers = {
    "Authorization": "Bearer <api_key>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.agentmail.to/v0/inboxes/inbox_id/credentials/credential_id';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <api_key>', 'Content-Type': 'application/json'},
  body: '{}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.agentmail.to/v0/inboxes/inbox_id/credentials/credential_id"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("Authorization", "Bearer <api_key>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.agentmail.to/v0/inboxes/inbox_id/credentials/credential_id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <api_key>'
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://api.agentmail.to/v0/inboxes/inbox_id/credentials/credential_id")
  .header("Authorization", "Bearer <api_key>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.agentmail.to/v0/inboxes/inbox_id/credentials/credential_id', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <api_key>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.agentmail.to/v0/inboxes/inbox_id/credentials/credential_id");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "Bearer <api_key>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <api_key>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/inboxes/inbox_id/credentials/credential_id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```