# Refetch brand icon

Refresh the workspace's icon from its primary website. Reports an error when the domain or a suitable icon is unavailable.

POST https://api.brigg.app/v1/operations/workspace.RefetchBrandIcon

## Access & visibility

Allow `workspace.RefetchBrandIcon` on your API key.

**Workspace access by default.** Private member data requires [approved member delegation](https://developer.brigg.app/authentication#member-delegation) through `Brigg-Act-As`; the key supplies permissions while private ownership and project boundaries remain enforced.

[Set up authentication](https://developer.brigg.app/authentication) · [Choose permissions](https://developer.brigg.app/permissions)

## Request

No parameters. Send an empty JSON object (`{}`).

## Refresh from the workspace website

Read [Get branding](https://developer.brigg.app/reference/workspace/GetBranding) first. This uses the workspace's primary domain configured in Brigg; it does not accept an arbitrary URL. It fetches that website's icon and replaces the workspace icon only. It does not update the logo or company profile.

If there is no configured domain, correct the workspace profile in Brigg. If the website cannot be read or supplies no usable icon, fix the website or use [Update branding](https://developer.brigg.app/reference/workspace/UpdateBranding) with an explicit image. Re-read branding after success when updating a local cache.

## Response

Returns **200 OK** with a JSON body.
| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `icon_url` | null or string | Yes | Absolute URL of the refreshed workspace icon. Null means the saved image could not be represented as a public URL; it is not an instruction to erase a cached icon. Read GetBranding to reconcile the saved branding. |

## Errors & retries

Set `BRIGG_REQUEST_ID` once for each logical action. The samples send it as `Idempotency-Key`. Reuse the same value and body on retries, including after a timeout; a missing response does not prove the action failed.

For rate limits, follow the server’s retry guidance and back off. See [HTTP errors](https://developer.brigg.app/http#errors) and [safe retries and limits](https://developer.brigg.app/reliability).

| HTTP status | Code | What to do |
| --- | --- | --- |
| 400 | `invalid_json` | Send a JSON object with Content-Type: application/json. |
| 400 | `invalid_input` | Check the request fields and types. Supply a stable Idempotency-Key containing 1–200 characters. |
| 401 | `invalid_key` | The workspace API key is missing, invalid or revoked. |
| 403 | `forbidden` | Check the key’s operation and resource grants. If Brigg-Act-As is supplied, the key must be authorized to delegate to that member. |
| 404 | `not_found` | The requested operation or resource is not available to this credential. |
| 429 | `rate_limited` | Wait for Retry-After before retrying. Reuse the original Idempotency-Key. |
| 400 | `no_domain` | Set the workspace's primary website in Brigg before refreshing its icon. |
| 502 | `scrape_failed` | The website could not be read. Check that it is reachable, or upload an icon through UpdateBranding. |
| 404 | `icon_not_found` | No usable website icon was found. Supply an image through UpdateBranding instead. |

## Next steps

- [Get branding](https://developer.brigg.app/reference/workspace/GetBranding)
- [Update branding](https://developer.brigg.app/reference/workspace/UpdateBranding)
- [Update workspace profile](https://developer.brigg.app/reference/workspace/UpdateWorkspaceProfile)

[Download OpenAPI](https://developer.brigg.app/openapi.json) · [Versioning & retirement](https://developer.brigg.app/versioning)

## Examples

### Example request

Fictional values. Replace IDs and business details with values from your workspace.
#### cURL


```sh
curl 'https://api.brigg.app/v1/operations/workspace.RefetchBrandIcon' \
  -H "Authorization: Bearer $BRIGG_API_KEY" \
  -H 'Content-Type: application/json' \
  -H "Idempotency-Key: $BRIGG_REQUEST_ID" \
  --data-raw '{}'
```

#### TypeScript


```typescript
const requestId = process.env.BRIGG_REQUEST_ID;
if (!requestId) throw new Error("Set BRIGG_REQUEST_ID once per action and reuse it on retries.");

const response = await fetch("https://api.brigg.app/v1/operations/workspace.RefetchBrandIcon", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.BRIGG_API_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": requestId, // Create once per action; reuse on retries.
  },
  body: JSON.stringify({}),
});
const result = await response.json();
if (!response.ok) throw new Error(`${response.status}: ${result.error} — ${result.message}`);
console.log(result);
```

#### Python


```python
import json
import os
from urllib.request import Request, urlopen
from urllib.error import HTTPError

request_id = os.environ["BRIGG_REQUEST_ID"]  # Reuse for retries of this action.
payload = {}
request = Request(
    "https://api.brigg.app/v1/operations/workspace.RefetchBrandIcon",
    data=json.dumps(payload).encode("utf-8"),
    headers={
        "Authorization": f"Bearer {os.environ['BRIGG_API_KEY']}",
        "Content-Type": "application/json",
        "Idempotency-Key": request_id,  # Create once per action; reuse on retries.
    },
    method="POST",
)
try:
    with urlopen(request) as response:
        print(json.load(response))
except HTTPError as error:
    print(error.code, json.load(error))
    raise
```

#### Response example


```json
{
  "icon_url": "https://example.com/icon.png"
}
```

## JSON schemas


```json-schema-request
{
  "type": "object",
  "properties": {},
  "additionalProperties": false,
  "examples": [
    {}
  ]
}
```


```json-schema-response
{
  "type": "object",
  "properties": {
    "icon_url": {
      "description": "Absolute URL of the refreshed workspace icon. Null means the saved image could not be represented as a public URL; it is not an instruction to erase a cached icon. Read GetBranding to reconcile the saved branding.",
      "title": "OpenAdThreadSubtaskAgent_phase",
      "anyOf": [
        {
          "type": "null",
          "description": "Absolute URL of the refreshed workspace icon. Null means the saved image could not be represented as a public URL; it is not an instruction to erase a cached icon. Read GetBranding to reconcile the saved branding."
        },
        {
          "type": "string",
          "description": "Absolute URL of the refreshed workspace icon. Null means the saved image could not be represented as a public URL; it is not an instruction to erase a cached icon. Read GetBranding to reconcile the saved branding."
        }
      ]
    }
  },
  "required": [
    "icon_url"
  ],
  "additionalProperties": false,
  "examples": [
    {
      "icon_url": "https://example.com/icon.png"
    }
  ]
}
```

