---
title: "ResourceShark API: Places"
description: "Create a place, list places, or update a place, with the ResourceShark API."
url: "https://agentpost.tools/docs/resourceshark/reference/places"
kind: reference
---

# Places

Create, list, and edit the places where stock is kept.

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

## Create a place

`POST /places`

Creates a place.

-   **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.places.create(body)`
-   **Idempotency-Key:** optional. [Retrying a write](/docs/platform/api-basics.md#retrying-a-write) has the rule.

### Body

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `key` | `string` | Yes | 1–200 characters. |
| `name` | `string` | Yes | 1–200 characters. |
| `attributes` | `object` | No | Each value is a `string`. |

### Response

`201 Created`, with [`PlaceResponse`](/docs/resourceshark/reference/places.md#the-placeresponse-object).

### Errors

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

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

```bash tab="curl"
curl -X POST https://api.agentpost.tools/v1/resources/places \
  -H "Authorization: Bearer sk_test_…" \
  -H "Content-Type: application/json" \
  -d '{
    "key": "roastery",
    "name": "Juniper Roastery"
  }'
```

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

const client = createClient({ token: 'sk_test_…' });
const { place } = await client.places.create({
  key: 'roastery',
  name: 'Juniper Roastery',
});
```

```json title="Response"
{
  "place": {
    "key": "roastery",
    "name": "Juniper Roastery",
    "id": "plc_01M83PPH000000000000000001"
  }
}
```

## List places

`GET /places`

Lists the places in the project.

-   **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.places.list(query)`
-   **Pages:** `limit`, 1 to 500, default 100, with `next` and `after`. [Lists](/docs/platform/api-basics.md#lists) has the rule.

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `after` | `string` | No | 1–200 characters. |
| `limit` | `integer` | No | 1–500; default `100`. |

### Response

`200 OK`, with [`PlacesPage`](/docs/resourceshark/reference/places.md#the-placespage-object).

### Errors

-   [`invalid_request`](/docs/resourceshark/errors.md#invalid_request) (400)

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

```bash tab="curl"
curl 'https://api.agentpost.tools/v1/resources/places?limit=20' \
  -H "Authorization: Bearer sk_test_…"
```

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

const client = createClient({ token: 'sk_test_…' });
const { places } = await client.places.list({ limit: 20 });
```

```json title="Response"
{
  "places": [
    {
      "key": "roastery",
      "name": "Juniper Roastery",
      "id": "plc_01M83PPH000000000000000001"
    },
    {
      "id": "plc_01M83PPH000000000000000002",
      "key": "market-stall",
      "name": "Juniper Market Stall"
    }
  ]
}
```

## Update a place

`PATCH /places/:id`

Edits a place.

-   **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.places.patch(id, body)`
-   **Idempotency-Key:** optional. [Retrying a write](/docs/platform/api-basics.md#retrying-a-write) has the rule.

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | Place ID, `plc_…`. The `id` of a [`Place`](/docs/resourceshark/reference/places.md#the-place-object). |

### Body

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `key` | `string` | No | 1–200 characters. |
| `name` | `string` | No | 1–200 characters. |
| `attributes` | `object` or `null` | No | Each value is a `string`. |

### Response

`200 OK`, with [`PlaceResponse`](/docs/resourceshark/reference/places.md#the-placeresponse-object).

### Errors

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

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

```bash tab="curl"
curl -X PATCH https://api.agentpost.tools/v1/resources/places/plc_01M83PPH000000000000000002 \
  -H "Authorization: Bearer sk_test_…" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Juniper Market Stall"
  }'
```

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

const client = createClient({ token: 'sk_test_…' });
const { place } = await client.places.patch('plc_01M83PPH000000000000000002', {
  name: 'Juniper Market Stall',
});
```

```json title="Response"
{
  "place": {
    "id": "plc_01M83PPH000000000000000002",
    "key": "market-stall",
    "name": "Juniper Market Stall"
  }
}
```

## The PlaceResponse object

| Name | Type | Present | Description |
| --- | --- | --- | --- |
| `place` | [`Place`](/docs/resourceshark/reference/places.md#the-place-object) | Always |  |

```json title="The PlaceResponse object"
{
  "place": {
    "key": "roastery",
    "name": "Juniper Roastery",
    "id": "plc_01M83PPH000000000000000001"
  }
}
```

## The PlacesPage object

| Name | Type | Present | Description |
| --- | --- | --- | --- |
| `places` | [`Place`](/docs/resourceshark/reference/places.md#the-place-object) array | Always |  |
| `next` | `string` | When set |  |

```json title="The PlacesPage object"
{
  "places": [
    {
      "key": "roastery",
      "name": "Juniper Roastery",
      "id": "plc_01M83PPH000000000000000001"
    },
    {
      "id": "plc_01M83PPH000000000000000002",
      "key": "market-stall",
      "name": "Juniper Market Stall"
    }
  ]
}
```

## The Place object

| Name | Type | Present | Description |
| --- | --- | --- | --- |
| `key` | `string` | Always | 1–200 characters. |
| `name` | `string` | Always | 1–200 characters. |
| `attributes` | `object` | When set | Each value is a `string`. |
| `id` | `string` | Always | Place ID, `plc_…`. |

```json title="The Place object"
{
  "key": "roastery",
  "name": "Juniper Roastery",
  "id": "plc_01M83PPH000000000000000001"
}
```
