> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.partnerpage.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.partnerpage.io/_mcp/server.

# Update a badge

PATCH https://v1.api.partnerpage.io/api/directory/private/v1alpha/directories/{directoryId}/badges/{badgeId}/
Content-Type: application/json

Update a directory badge. A new image is given either as base64 in `image` or as the URL returned by the files upload endpoint in `imageUrl`. In `imageUrl`, any other URL is refused, except the badge's current image URL, which is not a change; a URL in `image` is ignored. A badge always keeps an image, so neither field can clear it.

Reference: https://docs.partnerpage.io/api-reference/directory/badges/update-a-badge

## Authentication

- `Authorization` header (required) (prefixed with ` Token   `) — Your API key, sent as `Authorization: Token <your API key>`

## Request

### Path parameters

- `badgeId` (string, required)
- `directoryId` (string, required)

### Body (application/json)

This endpoint expects a PatchedBadgeSerializerUpdaterRequest.

- `title` (string, optional)
- `image` (string, optional)
- `imageUrl` (string, optional)

## Response

### 200

Successful operation

- `href` (string, required)
- `title` (string, required)
- `image` (string, required, nullable)
- `id` (string, required)
- `imageUrl` (string, optional, nullable)

## Errors

### 400 Bad Request Error

Bad Request - Validation Error

- `any`

### 404 Not Found Error

Partner Entry not found

- `any`

### 500 Internal Server Error

Internal server error

- `any`

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "href": "string",
  "title": "string",
  "image": "string",
  "id": "string",
  "imageUrl": "string"
}
```

**SDK Code**

```python
import requests

url = "https://v1.api.partnerpage.io/api/directory/private/v1alpha/directories/directoryId/badges/badgeId/"

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

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

print(response.json())
```

```javascript
const url = 'https://v1.api.partnerpage.io/api/directory/private/v1alpha/directories/directoryId/badges/badgeId/';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Token  <apiKey>', '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);
}
```