> ## Documentation Index
> Fetch the complete documentation index at: https://docs.postsyncer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# List Snippets

> Retrieve the saved snippets and hashtag groups of your workspaces

## List Snippets

Retrieves the saved snippets and hashtag groups of the workspaces the authenticated user has access to, ordered by `kind`, then `name`.

### Request

**workspace\_id** `integer`

Only list snippets of this workspace

**kind** `string`

Only list one kind: `snippet` or `hashtags`

```bash theme={null}
curl -X GET "https://postsyncer.com/api/v1/snippets?workspace_id=12" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
```

### Response

An array of [snippet objects](https://docs.postsyncer.com/api-reference/snippets/overview.md#the-snippet-object).

```json theme={null}
[
  {
    "id": 31,
    "workspace_id": 12,
    "kind": "hashtags",
    "name": "Launch tags",
    "body": "#launch #buildinpublic #saas",
    "created_by": 7,
    "created_at": "2026-11-17T09:12:44+00:00",
    "updated_at": "2026-11-17T09:12:44+00:00"
  },
  {
    "id": 32,
    "workspace_id": 12,
    "kind": "snippet",
    "name": "Sign-off",
    "body": "Thanks for reading! New posts every Tuesday.",
    "created_by": 7,
    "created_at": "2026-11-17T09:14:02+00:00",
    "updated_at": "2026-11-17T09:14:02+00:00"
  }
]
```

### Code Examples

```bash cURL theme={null}
curl -X GET "https://postsyncer.com/api/v1/snippets?kind=hashtags" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
```

```javascript Node.js theme={null}
const axios = require('axios');

const getSnippets = async () => {
  try {
    const response = await axios.get('https://postsyncer.com/api/v1/snippets', {
      params: { kind: 'hashtags' },
      headers: {
        'Authorization': 'Bearer YOUR_API_TOKEN'
      }
    });

    console.log('Snippets:', response.data);
    return response.data;
  } catch (error) {
    console.error('Error fetching snippets:', error.response?.data || error.message);
  }
};

getSnippets();
```

```php PHP theme={null}
<?php

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://postsyncer.com/api/v1/snippets?kind=hashtags');
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer YOUR_API_TOKEN'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($httpCode === 200) {
    $snippets = json_decode($response, true);
    echo "Found " . count($snippets) . " snippets";
} else {
    echo "Error: " . $response;
}
?>
```

```python Python theme={null}
import requests

headers = {
    'Authorization': 'Bearer YOUR_API_TOKEN'
}

response = requests.get(
    'https://postsyncer.com/api/v1/snippets',
    params={'kind': 'hashtags'},
    headers=headers
)

if response.status_code == 200:
    snippets = response.json()
    print(f"Found {len(snippets)} snippets")
    for snippet in snippets:
        print(f"{snippet['name']}: {snippet['body']}")
else:
    print(f"Error: {response.status_code}")
    print(response.text)
```

### Error Codes

**401** `Unauthorized`

Missing or invalid API token

**403** `Forbidden`

The key does not have the `snippets:read` permission

**422** `Unprocessable Entity`

`kind` is not `snippet` or `hashtags`


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.