# 2s EDIFACT Generator

> 2s EDIFACT Generator is a paid API for AI agents from 2s.io, paid per call via x402, $0.0018/call, status unknown (last checked 2026-09-13).

Generates UN/EDIFACT electronic data interchange messages (ORDERS purchase orders or INVOIC invoices) from structured input data

## Facts

- Endpoint: POST https://2s.io/api/edi/edifact-generate
- Price: $0.0018/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/2s-edifact-generator-826fdace
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_18-aAhwsbGiaK-EIMY5Ws

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability 2s-edifact-generator-826fdace -d '<json body>'
```

Example prompt: Generate a UN/EDIFACT ORDERS purchase order with document number PO-99012, sender ACME (ID 1234567890, qualifier 14), recipient BUYERCORP (ID 9876543210, qualifier 14), control ref 123456789, dated today, with two line items: 10 units of product SKU-001 at $5.00 each and 5 units of SKU-002 at $12.00 each.

## When to prefer this

Use this endpoint when you need to programmatically generate standards-compliant UN/EDIFACT messages (ORDERS or INVOIC) for B2B trading partner exchange without setting up a full EDI platform. It is ideal for AI agents automating procurement or invoicing workflows that need to produce EDI output on the fly at low per-call cost with no API key setup.

## Known failure modes

- Missing required senderId or recipientId returns validation error
- Invalid type enum value (not ORDERS or INVOIC) causes rejection
- INVOIC without total field may produce incomplete message
- Malformed items array (missing quantity, productId, or price) may generate invalid segments
- Payment failure (insufficient USDC) returns 402 Payment Required

## How this service works

The (most) everything API: 575+ pay-per-call endpoints for AI agents — ground-truth data, a full AI gateway, and agent infrastructure (storage, queues, watchers). USDC via x402, no signup, no API keys, and upto billing: pay actual usage, not the quote.

## Output

Returns a JSON object with ok:true, a meta.edi field containing the full raw EDIFACT message string (UNA/UNB/UNH/BGM/.../UNT/UNZ segments), an items array with controlRef and segmentCount for each generated interchange, a total count, and source/license attribution.

## Example request

```json
{
 "date": "20240115",
 "type": "ORDERS",
 "items": [
  {
   "price": 5,
   "quantity": 10,
   "productId": "SKU-001"
  },
  {
   "price": 12,
   "quantity": 5,
   "productId": "SKU-002"
  }
 ],
 "parties": [
  {
   "name": "BuyerCorp",
   "role": "BY"
  },
  {
   "name": "SupplierAcme",
   "role": "SU"
  }
 ],
 "senderId": "1234567890",
 "controlRef": "CTRL-001",
 "recipientId": "9876543210",
 "documentNumber": "PO-TEST-001",
 "senderQualifier": "14",
 "recipientQualifier": "14"
}
```

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "date": {
   "type": "string",
   "description": "CCYYMMDD (default today)."
  },
  "type": {
   "enum": [
    "ORDERS",
    "INVOIC"
   ],
   "type": "string",
   "description": "ORDERS (PO) or INVOIC (invoice)."
  },
  "items": {
   "type": "array",
   "items": {
    "type": "object"
   },
   "description": "Line items (quantity, productId, price)."
  },
  "total": {
   "type": "number",
   "description": "INVOIC total."
  },
  "parties": {
   "type": "array",
   "items": {
    "type": "object"
   },
   "description": "NAD loops (role+name)."
  },
  "senderId": {
   "type": "string"
  },
  "controlRef": {
   "type": "string"
  },
  "recipientId": {
   "type": "string"
  },
  "documentNumber": {
   "type": "string",
   "description": "Order or invoice number."
  },
  "senderQualifier": {
   "type": "string",
   "description": "Default 14 (GLN/EAN)."
  },
  "recipientQualifier": {
   "type": "string"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/2s-edifact-generator-826fdace/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from 2s.io](https://www.zero.xyz/host/2s.io/llms.txt)
