API Reference

x12port exposes two sets of API endpoints. Programmatic API key endpoints (/api/v1/*) are authenticated with a Bearer token and designed for server-to-server integrations. Session endpoints (/api/*) are used internally by the x12port web app and require an active browser session.

Authentication

🔑
API Key auth (/api/v1/* routes) — Generate a key from your Developer Dashboard. Include it as a Bearer token on every request:
Authorization: Bearer xp_test_YOUR_KEY
Sandbox keys start with xp_test_. Production keys start with xp_live_. The environment is determined by which key you use — the base URL is the same for both.
🖥
Session auth (/api/* routes) — Used by the Visual Mapping GUI and other browser-based tools. These routes require a logged-in session cookie and are not intended for server-to-server use. Use the /api/v1/* routes for all programmatic integrations.

Base URL

https://x12port.com/api/v1

All /api/v1 endpoints are relative to https://x12port.com. There is no separate API subdomain — do not use api.x12port.com.

Environments

EnvironmentKey prefixBehavior
Sandboxxp_test_Safe for development and testing. Sandbox keys filter partners and transactions to test-mode records only.
Productionxp_live_Live data. Available on paid Developer Pro and Enterprise plans. Production keys access all records.

Response format

All endpoints return JSON. Every response includes an ok boolean. Check ok before reading other fields.

// Success
{ "ok": true, ... }

// Error
{ "ok": false, "error": "Human-readable description of the problem" }

Endpoints — Programmatic (API key)

Health check

GET /api/v1/ping

Confirms that your API key is valid and shows which environment it belongs to. Good first call when setting up an integration.

Response:

{
  "ok": true,
  "message": "API key is valid.",
  "environment": "sandbox",
  "account": "Acme Corp",
  "account_type": "developer"
}

Parse a document

POST /api/v1/parse

Parses an EDI or structured document and returns all extracted fields. Supports X12 EDI, JSON, XML, and CSV.

ParameterTypeRequiredDescription
documentstringYesRaw document content — X12 EDI string, JSON, CSV, or XML
formatstringNoDocument format: x12 (default), json, csv, xml
elem_sepstringNoOverride element separator (X12 only). Detected automatically if omitted.
seg_termstringNoOverride segment terminator (X12 only). Detected automatically if omitted.

Response:

{
  "ok": true,
  "fields": {
    "ISA.06": "ACME-CORP",
    "ISA.08": "PARTNER",
    "BEG.03": "PO-88241",
    "BEG.05": "20260416",
    "PO1.02": "50",
    "PO1.04": "29.99"
  },
  "format": "x12",
  "tx_set": "850",
  "elem_sep": "*",
  "seg_term": "~",
  "field_count": 24,
  "environment": "sandbox"
}

Convert a document

POST /api/v1/convert

Converts a source document into a target format using a saved map ID or an inline field_map array. Use map_id to reference a map you built in the Visual Mapping GUI — this is the recommended approach for production integrations.

ParameterTypeRequiredDescription
documentstringYesRaw source document
map_idintegerConditionalID of a saved mapping project. Required unless field_map is provided.
field_maparrayConditionalInline array of mapping rule objects. Required unless map_id is provided.
source_formatstringNoOverrides the map's source format: x12, json, csv, xml
target_formatstringNoOverrides the map's target format
directionstringNoinbound (default) or outbound
save_to_vaultbooleanNoIf true, saves the converted output to your Document Vault and returns doc_id

Inline field_map rule object:

{
  "src":       "BEG.03",           // source field (segment.element notation)
  "tgt":       "order.po_number",  // target field (dot-notation for nested JSON)
  "transform": "none",             // none | uppercase | lowercase | trim | date_iso
  "note":      "PO number"         // optional description
}

Response:

{
  "ok": true,
  "output": "{\"order\":{\"po_number\":\"PO-88241\",\"date\":\"2026-04-16\"}}",
  "doc_id": 42,
  "environment": "sandbox"
}

List trading partners

GET /api/v1/partners

Returns trading partners associated with your account. Sandbox keys return only partners in testing status.

{
  "ok": true,
  "count": 2,
  "environment": "sandbox",
  "partners": [
    {
      "id": 1,
      "name": "Walmart",
      "partner_status": "testing",
      "inbound_url_test": "https://x12port.com/edi/receive/TOKEN?env=test"
    }
  ]
}

List transactions

GET /api/v1/transactions

Returns EDI transactions. Supports filtering and pagination.

Query paramDescription
directioninbound or outbound
tx_setTransaction set code, e.g. 850
partner_idFilter by trading partner ID
limitMax results (default 50, max 200)
offsetPagination offset

Submit a transaction

POST /api/v1/transactions/submit

Submits an EDI transaction to a trading partner.

ParameterRequiredDescription
partner_idYesTrading partner ID
tx_setYesTransaction set code, e.g. 850
directionYesinbound or outbound
contentYesRaw X12 EDI document content

List acknowledgements

GET /api/v1/acks

Returns 997/999 functional acknowledgements received for your transactions.

Endpoints — Session-authenticated (internal/browser)

The following endpoints require a logged-in session. They are used by the Visual Mapping GUI and are not intended for server-to-server integrations. For programmatic map execution, use POST /api/v1/convert with a map_id instead.

List mapping projects

GET /api/maps

Returns all mapping projects belonging to the authenticated user.

{
  "ok": true,
  "maps": [
    { "id": 7, "name": "Walmart 850 → Order JSON", "source_fmt": "x12", "target_fmt": "json", "tx_set": "850", "updated_at": "Apr 20, 2026" }
  ]
}

Get a mapping project

GET /api/maps/{id}

Returns the full detail of a mapping project including all rules.

Get a vault document

GET /api/vault/doc/{id}

Returns metadata and content of a stored Document Vault record.

{
  "ok": true,
  "doc": {
    "id": 42,
    "filename": "api_20260420_120000.json",
    "fmt": "json",
    "direction": "outbound",
    "content": "{ ... }",
    "file_size": 1024,
    "transaction_set": "850",
    "status": "processed",
    "created_at": "2026-04-20T12:00:00"
  }
}

HTTP status codes

StatusMeaning
200Success — check the ok field for application-level status
400Bad request — missing or invalid parameters, check the error field
401Unauthorized — missing or invalid API key
403Forbidden — account suspended or resource belongs to another user
404Not found — resource does not exist or is not yours
429Rate limited — too many requests
500Server error — try again or open a support ticket

Quick example

# 1. Verify your key
curl https://x12port.com/api/v1/ping \
  -H "Authorization: Bearer xp_test_YOUR_KEY"

# 2. Parse an X12 document
curl https://x12port.com/api/v1/parse \
  -X POST \
  -H "Authorization: Bearer xp_test_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"format":"x12","document":"ISA*00*..."}'

# 3. Convert using a saved map (map_id from your dashboard)
curl https://x12port.com/api/v1/convert \
  -X POST \
  -H "Authorization: Bearer xp_test_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"map_id":1,"document":"ISA*00*...","save_to_vault":true}'
✨ x12port Assistant
Free AI support • No credits needed
Hi! I’m the x12port AI Assistant. Ask me anything about EDI, your account, or how to use x12port. 👋