# Follow an RSS or Atom feed

> Page: https://docs.flung.dev/reference/api/post-v1-feeds. Index of every page: https://docs.flung.dev/llms.txt

Every new item becomes a post to the accounts, written from the template.

`POST /v1/feeds`

## TL;DR

| Question | Answer |
|---|---|
| What does it do? | Follow an RSS or Atom feed. |
| What does it need? | An API key or an OAuth access token. |
| What does it take? | A JSON body with the fields below. |
| What does it return? | Status 201 with a body of type [`Feed`](https://docs.flung.dev/reference/api/schemas.md#feed). |
| In the SDK? | `flung.feeds.create()` |
| As an MCP tool? | [`follow_feed`](https://docs.flung.dev/reference/mcp/follow-feed.md) |
| What can go wrong? | `401` Missing, unknown, revoked or expired API key; `422` The request failed validation; `429` Too many requests for this credential; wait for `retry-after` seconds. Every failure has the same [error shape](https://docs.flung.dev/reference/api/errors.md). |

## What it does

Every new item becomes a post to the accounts, written from the template. Checked about every 15 minutes; items already in the feed are not posted.

## Example

**curl**

```bash
curl -X POST 'https://api.flung.dev/v1/feeds' \
  --header "Authorization: Bearer $FLUNG_API_KEY" \
  --header 'Content-Type: application/json' \
  --header "Idempotency-Key: $(uuidgen)" \
  --data '{
  "url": "https://example.com",
  "accountIds": [
    "string"
  ]
}'
```

**TypeScript**

```ts
import { Flung } from '@flung.dev/sdk'

const flung = new Flung({ apiKey: process.env.FLUNG_API_KEY! })
const result = await flung.feeds.create({
  url: 'https://example.com',
  accountIds: [
    'string',
  ],
})
```

**fetch**

```js
const response = await fetch('https://api.flung.dev/v1/feeds', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${process.env.FLUNG_API_KEY}`,
    'Content-Type': 'application/json',
    'Idempotency-Key': crypto.randomUUID(),
  },
  body: JSON.stringify({
    url: 'https://example.com',
    accountIds: [
      'string',
    ],
  }),
})
if (!response.ok) throw new Error((await response.json()).error.message)
const result = await response.json()
```

A successful answer looks like this:

```json
{
  "id": "feed_aaaaaaaaaaaaaaaaaaaaaaaa",
  "url": "string",
  "accountIds": [
    "string"
  ],
  "template": "string",
  "enabled": true,
  "lastCheckedAt": "2026-11-01T09:00:00.000Z",
  "lastError": "string",
  "createdAt": "2026-11-01T09:00:00.000Z"
}
```

## Request body

The body has the type an object, with the fields below.

| Field | Type | Required | Description |
|---|---|---|---|
| `url` | `string` | yes | An RSS or Atom feed. Items already in it when it is added are not posted. at most 2048 characters. |
| `accountIds` | `string[]` | yes |  |
| `template` | `string` | no | at least 1 character; at most 5000 characters; default "{{title}} {{link}}". |

## Responses

| Status | Meaning | Body |
|---|---|---|
| 201 | The feed. | [`Feed`](https://docs.flung.dev/reference/api/schemas.md#feed) |
| 401 | Missing, unknown, revoked or expired API key. | [`Error`](https://docs.flung.dev/reference/api/schemas.md#error) |
| 422 | The request failed validation. | [`Error`](https://docs.flung.dev/reference/api/schemas.md#error) |
| 429 | Too many requests for this credential; wait for `retry-after` seconds. | [`Error`](https://docs.flung.dev/reference/api/schemas.md#error) |

## Response body

A 201 answer has the type [`Feed`](https://docs.flung.dev/reference/api/schemas.md#feed).

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | `string` | yes |  |
| `url` | `string` | yes |  |
| `accountIds` | `string[]` | yes |  |
| `template` | `string` | yes | The post text: `{{title}}`, `{{link}}`, `{{summary}}` from each item, and workspace variables. |
| `enabled` | `boolean` | yes |  |
| `lastCheckedAt` | `string \| null` | yes |  |
| `lastError` | `string \| null` | yes |  |
| `createdAt` | `string` | yes |  |

## See also

| Doc | Why |
|---|---|
| [API reference](https://docs.flung.dev/reference/api.md) | Every endpoint |
| [Schemas](https://docs.flung.dev/reference/api/schemas.md) | Every request and response type |
| [Errors](https://docs.flung.dev/reference/api/errors.md) | Every error code and what to do about it |
| [`follow_feed`](https://docs.flung.dev/reference/mcp/follow-feed.md) | The same operation as an MCP tool |
