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

# Code and sync entries

> Code an entry, approve it, and send it to the accounting platform.

Everything a reviewer does on the Accounting page in Slash, you can do
through the API.

## Code an entry

[Update an accounting entry](/api-reference/accounting/entries/update) with
the value ids you found in [Dimensions and values](/docs/v2/accounting/dimensions-and-coding):

```bash theme={null}
curl -X PATCH "https://api.slash.com/v2/accounting/entries/accounting_entry_2rj4l7hmrrrcv" \
  -H "X-API-Key: $SLASH_API_KEY" \
  -H "x-legal-entity: $SLASH_LEGAL_ENTITY_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "memo": "AWS hosting, September",
    "dimensions": {
      "account": "accounting_account_2rj4l7hmrrrcv",
      "class": "accounting_class_3sk5m8inssscw"
    }
  }'
```

Only the dimensions you send change. Send `null` to clear one. Coding an entry
doesn't change its status, so you can code in several passes and approve it
once at the end.

If a value isn't allowed, the error's `details.field` points at it, for example
`dimensions.class`. See [Errors](/docs/v2/get-started/errors).

## Split an entry

To code parts of a transaction differently, send `lineItems` with the full list
of editable lines. Lines with an `id` are updated, lines without one are added,
and lines you leave out are removed. The amounts must add up to the
transaction total.

```json theme={null}
{
  "lineItems": [
    {
      "id": "accounting_line_item_2rj4l7hmrrrcv",
      "amount": { "amount": 7500, "currency": "USD" },
      "dimensions": { "account": "accounting_account_2rj4l7hmrrrcv" }
    },
    {
      "amount": { "amount": 2500, "currency": "USD" },
      "dimensions": { "account": "accounting_account_4tl6n9jottdx" }
    }
  ]
}
```

<AccordionGroup>
  <Accordion title="Coding a bill entry">
    A bill entry takes its lines and amounts from the
    [bill](/docs/v2/bills/overview), so only the coding can change here. Each
    line needs the `id` of one of the entry's `lineItems`
    (`accounting_line_item_` prefix). `lineItemLevelDimensions`
    lists the dimensions coded per line; every other dimension is coded once
    for the whole bill.
  </Accordion>

  <Accordion title="Custom fields">
    Send custom field values in `customFields`, keyed by the field's key, on
    the entry or on a line item depending on the field. Sending `customFields`
    replaces the existing values.
  </Accordion>
</AccordionGroup>

## Approve and sync

| Action | What it does |
| - | - |
| [Mark ready](/api-reference/accounting/entries/mark-ready) | Approves the entry. Nothing is sent to the platform until it's synced. |
| [Sync](/api-reference/accounting/entries/sync) | Sends the entry to the platform. Syncing a `synced` entry updates the platform's record. |
| [Move back to review](/api-reference/accounting/entries/mark-in-review) | Returns the entry to `in_review`. |
| [Archive](/api-reference/accounting/entries/archive) | Sets the entry aside so it's never synced. |

Mark ready and sync check that every required dimension and custom field has
a value. If not, they return `entry_not_ready` and list everything that's
missing.

While an entry is `pending_sync` or `syncing`, changes return
`entry_sync_in_progress` until the platform responds. Sync returns
`connection_not_syncable` on a connection that isn't linked to a platform
Slash syncs with, such as a CSV export; those entries are handled from Slash.

## Work in batches

[Run a status action on many accounting entries](/api-reference/accounting/entries/bulk)
applies one of the actions above to up to 100 entries:

```json theme={null}
{
  "action": "mark_ready",
  "entryIds": ["accounting_entry_2rj4l7hmrrrcv", "accounting_entry_3o1xabrjl8s8x"]
}
```

Each entry is handled on its own, so one that isn't ready doesn't stop the
rest. The response lists the result for each entry.

## Attach receipts

Upload the file as a [document](/docs/v2/concepts/documents) with
`purpose=accounting_receipt`, then add it with
[Attach a document to an accounting entry](/api-reference/accounting/entries/attachments/add).
It's sent to the platform with the entry's next sync. A bill's entry takes its
files from the bill: [add them to the bill](/api-reference/bills/documents/add)
instead.

## Track sync results

After a sync, fetch the entry with
[Get an accounting entry](/api-reference/accounting/entries/retrieve) until its
`status` is `synced` or `failed`. If it `failed`, `lastSyncError` explains why
in a `message` you can show users, with a `suggestion` for fixing it; fix the
coding and sync it again.

To find the entries still waiting for review,
[list accounting entries](/api-reference/accounting/entries/list) with
`status=in_review`. Entries come newest first. To find entries the platform
rejected, use `status=failed`.


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