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

# CRSTL Integration

> Automate EDI purchase order acknowledgements, invoicing, and price checks via CRSTL.

<Note>
  **Who this is for:** Brand administrators. Go to **Settings → Integrations → CRSTL**.
</Note>

CRSTL connects Keystone to retail EDI workflows — purchase order acknowledgements (855), advance ship notices that trigger Shopify fulfillment, invoice generation, and PO price validation.

## Connecting CRSTL

1. In CRSTL, go to [omnicrstl.web.app/api-keys](https://omnicrstl.web.app/api-keys) and generate an **API key**. Give it scopes for reading transactions and sending acknowledgements (855) and invoices (810).
2. In Keystone, go to **Settings → Integrations → CRSTL**.
3. Paste the **API key** into the connection form.
4. Choose **Production** or **Sandbox** environment.
5. Click **Test connection** to verify the key.
6. Click **Save**.

The API key is write-only after save — it is never shown again. To rotate, generate a new key in CRSTL and paste it in the same form.

## Tenant automation settings

On the same page, configure defaults applied to trading partners:

| Setting                         | Purpose                                                                   |
| ------------------------------- | ------------------------------------------------------------------------- |
| **Inventory source**            | Deposco warehouse or Shopify ATS for PO acknowledgement quantities        |
| **Default inventory threshold** | Minimum qty before acknowledging partial stock                            |
| **Partial stock strategy**      | How to handle lines that cannot be fully acknowledged                     |
| **PO pricing check**            | Compare EDI PO prices against Keystone prices with configurable tolerance |

## Trading partners and rules

After connecting, configure per-partner behavior:

| Page                 | Purpose                                                                                                 |
| -------------------- | ------------------------------------------------------------------------------------------------------- |
| **Trading Partners** | Enable or disable automation per retailer                                                               |
| **Partner Rules**    | Document-type rules (855 ack, invoice triggers, price checks) per partner                               |
| **Outbox**           | Every CRSTL document Keystone owes a retailer — review, overdue, failed, in flight, or blocked by setup |

Access these from the links on the CRSTL integration page or **Settings → Integrations → CRSTL** sub-pages.

## The Outbox

The **Outbox** is the single place brand admins go to see and act on documents CRSTL is waiting on. Five stat cards filter the table:

| Card             | What it means                                                  | Action                                               |
| ---------------- | -------------------------------------------------------------- | ---------------------------------------------------- |
| **Failed**       | Send errored                                                   | Retry                                                |
| **Needs review** | Partner rule requires approval OR price/inventory check failed | Approve & send, dismiss, or override rules           |
| **Overdue**      | Past your tenant SLA and still not sent                        | Send now or re-queue                                 |
| **In flight**    | Auto-processing normally within SLA                            | Send now (skip the cron wait) or re-queue            |
| **Setup**        | Partner missing, automation off, or CRSTL/Keystone mismatch    | Configure rules, mark not required, or send manually |

Only **Failed**, **Needs review**, and **Overdue** count toward the sidebar badge — **In flight** and **Setup** are informational.

### ASN → Shopify fulfillment

When a partner's **ASN** rule is enabled, Keystone:

1. Detects the ASN on the CRSTL purchase order (poll every \~5 minutes).
2. Finds the Shopify order whose **tags** or **note** contain that PO number.
3. Creates a **line-level** (partial) fulfillment from the ASN shipped quantities + tracking.
4. Only then builds/sends the **810 invoice**.

If no Shopify order matches, Keystone marks the invoice row failed and emails the addresses configured under action-item notifications (or brand admins). Add the PO as a tag or in the order note, then retry from the Outbox.

Merchants must re-authorize the Shopify app after this feature ships so Keystone receives `write_fulfillments` and `write_merchant_managed_fulfillment_orders`.

### "Send now" vs. automatic processing

Every 5 minutes the CRSTL poll workers pick up pending documents and either send them, stage them for review, or skip them per your partner rules. **Send now** on an in-flight or overdue row runs that same logic immediately as an audited manual action — useful when you don't want to wait for the next cron pass.

## Disconnecting

**Disconnect** stops all CRSTL automation until you reconnect. Confirm before disconnecting in production.

## Related

* [Inventory & ATS](/app-guide/inventory) — inventory source for acknowledgements
* [Integrations overview](/integrations/overview) — Shopify and Deposco as inventory sources
