# Import many posts from a CSV or a list of rows

> For AI agents: the index of these docs is at https://indrava.forumulate.com/docs/llms.txt (every page it lists has a Markdown version like this one).

## Import many posts from a CSV or a list of rows

**`POST http://localhost:4000/api/v1/posts/import`** — Import many posts from a CSV or a list of rows

Send `csv` (the template's columns; `GET /posts/import/template`) or `rows` (the same fields as JSON, at most 500). `format` is how dates are written (`YYYY-MM-DD HH:mm`, `DD/MM/YYYY`, `MM/DD/YYYY` or `ISO`), read in `timezone` or the workspace's. `mode`: `draft` saves everything as drafts, `schedule` publishes at each row's time (a row without one takes the next queue slot), `queue` puts every row at the next free slot. A row with an `id` updates that post. With `dryRun: true` nothing is created and the answer holds each row's errors and warnings, rejected rows grouped by cause. Otherwise the valid rows are created (`allOrNothing: true` creates none when any row is rejected) and each row's result is returned. Send `batchKey` to make a retry safe. Scheduling needs the `posts:publish` scope.

### Request body (`application/json`)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `csv` | string | no |  |
| `rows` | object[] | no |  |
| `rows.line` | integer | no |  |
| `rows.id` | string | no |  |
| `rows.text` | string | no |  |
| `rows.date` | string | no |  |
| `rows.time` | string | no |  |
| `rows.timezone` | string | no |  |
| `rows.draft` | string | no |  |
| `rows.client` | string | no |  |
| `rows.tags` | string | no |  |
| `rows.channels` | string | no |  |
| `rows.firstComment` | string | no |  |
| `rows.link` | string | no |  |
| `rows.media` | object[] | no |  |
| `rows.media.url` | string | yes |  |
| `rows.media.alt` | string | no |  |
| `rows.mediaIds` | string[] | no |  |
| `rows.thumbnailUrl` | string | no |  |
| `rows.settings` | object | no |  |
| `format` | string | no | One of: `YYYY-MM-DD HH:mm` \| `DD/MM/YYYY` \| `MM/DD/YYYY` \| `ISO`. Default: `YYYY-MM-DD HH:mm`. |
| `mode` | string | no | One of: `draft` \| `schedule` \| `queue`. Default: `schedule`. |
| `timezone` | string | no |  |
| `dryRun` | boolean | no |  |
| `allOrNothing` | boolean | no |  |
| `batchKey` | string | no |  |

```json
{
  "csv": "string",
  "rows": [
    {
      "line": 0,
      "id": "string",
      "text": "string",
      "date": "string",
      "time": "string",
      "timezone": "string",
      "draft": "string",
      "client": "string",
      "tags": "string",
      "channels": "string",
      "firstComment": "string",
      "link": "string",
      "media": [
        {
          "url": "string",
          "alt": "string"
        }
      ],
      "mediaIds": [
        "string"
      ],
      "thumbnailUrl": "string",
      "settings": {}
    }
  ],
  "format": "YYYY-MM-DD HH:mm",
  "mode": "schedule",
  "timezone": "string",
  "dryRun": true,
  "allOrNothing": true,
  "batchKey": "string"
}
```

### Responses

**200** — OK

#### Option 1

#### Option 2

```json
{}
```

### Code samples

**cURL**

```curl
curl -X POST "http://localhost:4000/api/v1/posts/import" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"csv":"string","rows":[{"line":0,"id":"string","text":"string","date":"string","time":"string","timezone":"string","draft":"string","client":"string","tags":"string","channels":"string","firstComment":"string","link":"string","media":[{"url":"string","alt":"string"}],"mediaIds":["string"],"thumbnailUrl":"string","settings":{}}],"format":"YYYY-MM-DD HH:mm","mode":"schedule","timezone":"string","dryRun":true,"allOrNothing":true,"batchKey":"string"}'
```

**TypeScript**

```typescript
const res = await fetch('http://localhost:4000/api/v1/posts/import', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer $API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"csv":"string","rows":[{"line":0,"id":"string","text":"string","date":"string","time":"string","timezone":"string","draft":"string","client":"string","tags":"string","channels":"string","firstComment":"string","link":"string","media":[{"url":"string","alt":"string"}],"mediaIds":["string"],"thumbnailUrl":"string","settings":{}}],"format":"YYYY-MM-DD HH:mm","mode":"schedule","timezone":"string","dryRun":true,"allOrNothing":true,"batchKey":"string"}),
});
const data = await res.json();
```

**Python**

```python
import requests

res = requests.request(
    "POST",
    "http://localhost:4000/api/v1/posts/import",
    headers={
    "Authorization": "Bearer $API_KEY",
    "Content-Type": "application/json",
    },
    json={"csv": "string", "rows": [{"line": 0, "id": "string", "text": "string", "date": "string", "time": "string", "timezone": "string", "draft": "string", "client": "string", "tags": "string", "channels": "string", "firstComment": "string", "link": "string", "media": [{"url": "string", "alt": "string"}], "mediaIds": ["string"], "thumbnailUrl": "string", "settings": {}}], "format": "YYYY-MM-DD HH:mm", "mode": "schedule", "timezone": "string", "dryRun": True, "allOrNothing": True, "batchKey": "string"},
)
data = res.json()
```

**Go**

```go
package main

import (
	"fmt"
	"io"
	"net/http"
	"strings"
)

func main() {
	req, _ := http.NewRequest("POST", "http://localhost:4000/api/v1/posts/import", strings.NewReader(`{"csv":"string","rows":[{"line":0,"id":"string","text":"string","date":"string","time":"string","timezone":"string","draft":"string","client":"string","tags":"string","channels":"string","firstComment":"string","link":"string","media":[{"url":"string","alt":"string"}],"mediaIds":["string"],"thumbnailUrl":"string","settings":{}}],"format":"YYYY-MM-DD HH:mm","mode":"schedule","timezone":"string","dryRun":true,"allOrNothing":true,"batchKey":"string"}`))
	req.Header.Set("Authorization", "Bearer $API_KEY")
	req.Header.Set("Content-Type", "application/json")
	res, _ := http.DefaultClient.Do(req)
	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)
	fmt.Println(string(body))
}
```

**PHP**

```php
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://localhost:4000/api/v1/posts/import');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer $API_KEY', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"csv":"string","rows":[{"line":0,"id":"string","text":"string","date":"string","time":"string","timezone":"string","draft":"string","client":"string","tags":"string","channels":"string","firstComment":"string","link":"string","media":[{"url":"string","alt":"string"}],"mediaIds":["string"],"thumbnailUrl":"string","settings":{}}],"format":"YYYY-MM-DD HH:mm","mode":"schedule","timezone":"string","dryRun":true,"allOrNothing":true,"batchKey":"string"}');
$response = curl_exec($ch);
curl_close($ch);
echo $response;
```

**Ruby**

```ruby
require 'net/http'
require 'uri'

uri = URI('http://localhost:4000/api/v1/posts/import')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer $API_KEY'
req['Content-Type'] = 'application/json'
req.body = '{"csv":"string","rows":[{"line":0,"id":"string","text":"string","date":"string","time":"string","timezone":"string","draft":"string","client":"string","tags":"string","channels":"string","firstComment":"string","link":"string","media":[{"url":"string","alt":"string"}],"mediaIds":["string"],"thumbnailUrl":"string","settings":{}}],"format":"YYYY-MM-DD HH:mm","mode":"schedule","timezone":"string","dryRun":true,"allOrNothing":true,"batchKey":"string"}'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
  http.request(req)
end
puts res.body
```

**Java**

```java
import java.net.URI;
import java.net.http.*;
import java.net.http.HttpRequest.BodyPublishers;

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("http://localhost:4000/api/v1/posts/import"))
    .header("Authorization", "Bearer $API_KEY")
    .header("Content-Type", "application/json")
    .method("POST", BodyPublishers.ofString("{\"csv\":\"string\",\"rows\":[{\"line\":0,\"id\":\"string\",\"text\":\"string\",\"date\":\"string\",\"time\":\"string\",\"timezone\":\"string\",\"draft\":\"string\",\"client\":\"string\",\"tags\":\"string\",\"channels\":\"string\",\"firstComment\":\"string\",\"link\":\"string\",\"media\":[{\"url\":\"string\",\"alt\":\"string\"}],\"mediaIds\":[\"string\"],\"thumbnailUrl\":\"string\",\"settings\":{}}],\"format\":\"YYYY-MM-DD HH:mm\",\"mode\":\"schedule\",\"timezone\":\"string\",\"dryRun\":true,\"allOrNothing\":true,\"batchKey\":\"string\"}"))
    .build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
```

---

## For AI agents

- This page for a human reader: https://indrava.forumulate.com/docs/ref-bulk-import
- The whole space as one Markdown file: https://indrava.forumulate.com/docs/llms-full.txt
- Live search + fetch over MCP: https://indrava.forumulate.com/docs/_api/public/orgs/e421ace4-3e78-4ed8-9818-7b4899cf3aa0/spaces/2bcc7f09-4489-40af-85d8-9fdd3f3da314/mcp
  - Install (Claude CLI): `claude mcp add forumulate-docs --transport http https://indrava.forumulate.com/docs/_api/public/orgs/e421ace4-3e78-4ed8-9818-7b4899cf3aa0/spaces/2bcc7f09-4489-40af-85d8-9fdd3f3da314/mcp`

This Markdown is the same content the page renders — safe to quote and to ground answers in.
