API Reference

Everything the console does, over a token-secured JSON API.

Overview

The AS2Expert API is served under a single base URL:

https://b2b.as2expert.com/api/v1

All endpoints are invoked with HTTP POST and exchange JSON. Requests without a body still use POST with an empty JSON object. Every response carries a status field — "success" or an error indicator — alongside the payload.

Authentication

Every request must include your API token as a Bearer credential:

curl -X POST https://b2b.as2expert.com/api/v1/stations   -H "Authorization: Bearer YOUR_API_TOKEN"   -H "Content-Type: application/json"   -d '{}'
  • Tokens identify your account and carry scopes (read, write, admin) that are enforced on every call.
  • Tokens are issued from the authenticated console — they are never created during public signup, and they are stored server-side only as SHA-256 hashes.
  • Keep tokens out of frontend code and repositories. Rotate a token by issuing a replacement and revoking the old one.

Conventions

  • POST everywhere. Listing, detail and action endpoints all use POST with a JSON body.
  • English canonical, Spanish accepted. Canonical field names are English (partner, subject, file_name…). Historical Spanish aliases (socio, asunto, fichero_nombre…) remain accepted on requests, and responses include both spellings where they exist. New integrations should use the English names.
  • Listings return data[] plus a total count. Detail endpoints return a single data object.
  • Binary content travels Base64-encoded inside JSON.

Dashboard

POST /dashboard/kpis

Aggregated activity for your account over the last 30 days.

ResponseDescription
data.mensajes_30dMessages exchanged in the window
data.exitososSuccessful exchanges
data.erroresFailed exchanges
data.tasa_exito_pctSuccess rate, percent

Stations

POST /stations

List the stations your token can access.

Request
idoptional Restrict the listing to one station
Response item
id, name, as2_id Station identity (Spanish aliases included)
POST /stations/detail

Full detail of one station, including its folders.

Request
idrequired Station id
POST /stations/stats

Traffic metrics for one station or one of its folders: totals, success ratio and volume.

Request
stationrequired Station id (id is accepted as an alias)
folderoptional Restrict the metrics to one folder subtree

Partners

POST /partners

List partner profiles.

Request
stationoptional Filter by station id
Response item
id, name, as2_id Partner identity
POST /partners/detail

Full detail of one partner, including its station_name.

Request
idrequired Partner id

Certificates

POST /certificates

List the certificates visible to your account. Items carry id, commonName and the owner email.

POST /certificates/detail
Request
idrequired Certificate id

Messages

POST /messages

List messages, newest first.

Request
stationoptional Filter by station id
folderoptional Filter by folder
limitoptional Page size
Response item
id, asunto, folder_name, station_name, size_bytes Message summary
POST /messages/detail

Headers, states and identity of one message (message_id is the AS2 Message-ID). The response includes the AS2 state fields com, firma, encriptacion and mdn.

Request
idrequired Message id
POST /messages/download

The decrypted payload of one message, Base64-encoded in data.content_b64.

Request
idrequired Message id
POST /messages/files

List the individual files carried inside one message (id required). Download one of them with /messages/file-download passing id and the file index or name returned here.

POST /messages/changes

Incremental polling: messages that changed since a given marker — the natural primitive for synchronizing an external system without re-listing everything.

POST /messages/move · /messages/delete · /messages/mark-read · /messages/mark-unread · /messages/export

Bulk message actions. All of them accept message_ids (array) — /messages/move also takes the destination folder. They require the write scope.

Send a message

POST /messages/send

Queue a document for a partner. Signing, encryption, compression and MDN follow the partner's configured policy.

Request
partnerrequired Partner id
subjectrequired Message subject
file_namerequired File name of the document
file_contentrequired Document content, Base64
Response
data.message_id AS2 Message-ID assigned to the outbound message
# Send a document to partner 42
curl -X POST https://b2b.as2expert.com/api/v1/messages/send   -H "Authorization: Bearer YOUR_API_TOKEN"   -H "Content-Type: application/json"   -d '{
    "partner": 42,
    "subject": "ORDERS 2026-08-21",
    "file_name": "orders.edi",
    "file_content": "VU5BOisuPyoUTkIrVU5PQzoz..."
  }'

Webhooks

POST /webhooks/configure
Request
partner_idrequired Partner the webhook belongs to
webhook_urlrequired HTTPS endpoint to notify
webhook_enabledrequired Enable or disable delivery
webhook_eventsrequired Event list to subscribe to
POST /webhooks/get

Current webhook configuration for one partner (partner_id required). Returns the config object with URL, enabled flag and events.

POST /webhooks/test

Send a test event to the configured webhook of one partner (partner_id required) and report the delivery result.

POST /webhooks/logs

Delivery history for one partner (partner_id required): each entry carries log_id, event, success, attempts and created_at.

Errors

Errors are reported both by HTTP status and in the body:

StatusMeaning
401Missing or invalid token
403Token lacks the required scope, or the resource does not belong to your account
404Unknown endpoint or resource
429Rate limit exceeded — retry with backoff
5xxServer-side failure — safe to retry idempotent reads

Error bodies carry status and a human-readable msg. Treat any status other than "success" as a failure even when the HTTP code is 200.

Integrating for the first time? Start with POST /stations — it needs an empty body and proves your token and scopes in one call.