---
title: "ResourceShark API: Config"
description: "Get the config or update the config, with the ResourceShark API."
url: "https://agentpost.tools/docs/resourceshark/reference/config"
kind: reference
---

# Config

Read or replace the project’s versioned retention settings.

Paths are relative to `https://api.agentpost.tools/v1/resources`. [Who may call](/docs/resourceshark/reference.md#who-may-call) explains each credential.

## Get the config

`GET /config`

Reads the project’s config and its version.

-   **Who may call:** Your server, with your project’s secret key.
-   **Credential:** the examples send your project’s `dev` secret key, `sk_test_…`, as `Authorization: Bearer <token>`.
-   **SDK:** `client.config.get()`

### Response

`200 OK`, with [`ConfigResponse`](/docs/resourceshark/reference/config.md#the-configresponse-object).

### Errors

Only the codes any operation can answer with, which [Conventions](/docs/resourceshark/reference.md#conventions) lists.

```bash tab="curl"
curl https://api.agentpost.tools/v1/resources/config \
  -H "Authorization: Bearer sk_test_…"
```

```ts tab="SDK"
import { createClient } from '@agentpost-tools/resourceshark-sdk';

const client = createClient({ token: 'sk_test_…' });
const { config } = await client.config.get();
```

```json title="Response"
{
  "config": {
    "retention": {
      "events": "30d",
      "resolvedHolds": "3d"
    },
    "version": 1,
    "updatedAt": "2026-11-23T08:00:00.000Z",
    "updatedBy": "service:juniper-backend"
  }
}
```

## Update the config

`PUT /config`

Replaces the project’s config. Send the version you read in If-Match.

-   **Who may call:** Your server, with your project’s secret key.
-   **Credential:** the examples send your project’s `dev` secret key, `sk_test_…`, as `Authorization: Bearer <token>`.
-   **SDK:** `client.config.put(body, { ifMatch })`
-   **Idempotency-Key:** optional. [Retrying a write](/docs/platform/api-basics.md#retrying-a-write) has the rule.
-   **If-Match:** Required. Send the version you read.

### Body

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `retention` | `object` | Yes |  |
| `retention.events` | `string` | Yes | A duration, such as “10m” or “7d”. |
| `retention.resolvedHolds` | `string` | Yes | A duration, such as “10m” or “7d”. |

### Response

`200 OK`, with [`ConfigResponse`](/docs/resourceshark/reference/config.md#the-configresponse-object).

### Errors

-   [`invalid_request`](/docs/resourceshark/errors.md#invalid_request) (400)
-   [`payload_too_large`](/docs/resourceshark/errors.md#payload_too_large) (413)
-   [`stale_version`](/docs/resourceshark/errors.md#stale_version) (409)

Any operation can also answer with the codes [Conventions](/docs/resourceshark/reference.md#conventions) lists.

```bash tab="curl"
curl -X PUT https://api.agentpost.tools/v1/resources/config \
  -H "Authorization: Bearer sk_test_…" \
  -H "If-Match: 1" \
  -H "Content-Type: application/json" \
  -d '{
    "retention": {
      "events": "60d",
      "resolvedHolds": "3d"
    }
  }'
```

```ts tab="SDK"
import { createClient } from '@agentpost-tools/resourceshark-sdk';

const client = createClient({ token: 'sk_test_…' });
const { config } = await client.config.put(
  { retention: { events: '60d', resolvedHolds: '3d' } },
  { ifMatch: 1 },
);
```

```json title="Response"
{
  "config": {
    "retention": {
      "events": "60d",
      "resolvedHolds": "3d"
    },
    "version": 2,
    "updatedAt": "2026-11-23T08:10:00.000Z",
    "updatedBy": "service:juniper-backend"
  }
}
```

## The ConfigResponse object

| Name | Type | Present | Description |
| --- | --- | --- | --- |
| `config` | [`ConfigRecord`](/docs/resourceshark/reference/config.md#the-configrecord-object) | Always |  |

```json title="The ConfigResponse object"
{
  "config": {
    "retention": {
      "events": "30d",
      "resolvedHolds": "3d"
    },
    "version": 1,
    "updatedAt": "2026-11-23T08:00:00.000Z",
    "updatedBy": "service:juniper-backend"
  }
}
```

## The ConfigRecord object

| Name | Type | Present | Description |
| --- | --- | --- | --- |
| `retention` | `object` | Always |  |
| `retention.events` | `string` | Always | A duration, such as “10m” or “7d”. |
| `retention.resolvedHolds` | `string` | Always | A duration, such as “10m” or “7d”. |
| `version` | `number` | Always |  |
| `updatedAt` | `string` | Always | An ISO 8601 date and time. |
| `updatedBy` | `string` | Always |  |

```json title="The ConfigRecord object"
{
  "retention": {
    "events": "30d",
    "resolvedHolds": "3d"
  },
  "version": 1,
  "updatedAt": "2026-11-23T08:00:00.000Z",
  "updatedBy": "service:juniper-backend"
}
```
