# Generate the MOVEIN file for Hashavshevet (חשבשבת)

`POST /businesses/{bid}/exports/movein`

Requires the `export` scope.

The period as journal movements an accountant imports into Hashavshevet (כללי > ממשקים > יבוא תנועות הנהח): a zip with `movein.doc` + `movein.prm` (the flexible method; the PRM is written for the data, so the importer reads exactly these positions) or `movein.dat` (the detailed 180-character method), `heshin.doc` + `heshin.prm` for the cards that have their own number, and import instructions. Windows-1255, CRLF. Posting: an invoice debits the customer and credits income and output VAT; a receipt debits the box of each payment method and credits the customer; a credit note reverses an invoice; an expense debits its category and the deductible input VAT and credits the supplier; a proforma is not posted. Every movement balances. By default a document or an expense that went out in an earlier MOVEIN file stays out (`onlyNew`). Refused until the settings were saved once. Download the zip through `GET /files/{id}`.

## Path parameters

| Name | Type | | Description |
|---|---|---|---|
| `bid` | string | **required** | Business id, from `POST /businesses`. |

## Body

| Field | Type | | Description |
|---|---|---|---|
| `from` | string | **required** |  |
| `to` | string | **required** |  |
| `onlyNew` | boolean |  | Leave out what an earlier MOVEIN file carried. Default `true`. |

## Response

`201`: `{ "ok": true, … }`

| Field | Type | | Description |
|---|---|---|---|
| `ok` | boolean | **required** |  |
| `exportRun` | ExportRun | **required** | One OPENFRMT (מבנה אחיד) generation, with its verification summary. |
| `file` | FileMeta |  |  |
| `summary` | object |  |  |
| `warnings` | array of object |  |  |

Errors: `400`, `401`, `403`, `404`, `429`. Every failure answers `{ "error", "reason", "hint", "param", "doc_url", "retryable", "request_id" }`: branch on `reason`, and read `hint` for what to change (https://docs.billos.co.il/errors.md).

## Examples

### cURL

```bash
curl -X POST "$BASE/businesses/$BID/exports/movein" \
  -H "X-Api-Key: $KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "2026-07-01",
    "to": "2026-07-31"
  }'
```
### Node

```node
const res = await fetch(`${BASE}/businesses/${BID}/exports/movein`, {
  method: 'POST',
  headers: {
    'X-Api-Key': KEY,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "from": "2026-07-01",
    "to": "2026-07-31"
  }),
})
const data = await res.json()
if (!data.ok) throw new Error(data.reason)
```
### Python

```python
import requests
res = requests.post(
    f"{BASE}/businesses/{BID}/exports/movein",
    headers={"X-Api-Key": KEY},
    json={
      "from": "2026-07-01",
      "to": "2026-07-31"
    },
)
data = res.json()
```