Receiving AS2 Messages
AS2aaS handles incoming AS2 messages automatically through dedicated receiving endpoints. This guide explains how message receiving works and how to configure your trading partners to send messages to your AS2aaS endpoint.
AS2 Receiving Endpoint
AS2 Receiving Endpoint
https://as2.as2aas.com/as2/receive
How Message Receiving Works
1. AS2 Message Flow
Loading diagram...
The AS2aaS platform automatically processes incoming messages through a secure, enterprise-grade processing pipeline.
2. Message Processing Steps
- Message Reception: AS2 message received at
as2.as2aas.com/as2/receive
- Protocol Handling: AS2aaS processing engine handles AS2 protocol (encryption, signatures, compression)
- Partner Validation: Verify sending partner is configured and authorized
- Payload Extraction: Extract and store business document payload
- MDN Generation: Generate and return Message Disposition Notification
- Secure Storage: Store message metadata and delivery status
- Event Notification: Notify your application via configured webhooks
Partner Configuration
Setting Up Partners to Send to You
Provide your trading partners with these details:
AS2 Configuration:
AS2 URL: https://as2.as2aas.com/as2/receive
AS2-From: [Partner's AS2 ID]
AS2-To: [Your AS2 ID from dashboard]
Content-Type: application/pkcs7-mime (for encrypted)
or application/pkcs7-signature (for signed)
or application/edi-x12 (for plain EDI)
Security Requirements:
- Encryption: Supported algorithms:
AES128_CBC
,AES192_CBC
,AES256_CBC
,3DES
- Signing: Supported algorithms:
SHA1withRSA
,SHA256withRSA
,SHA384withRSA
,SHA512withRSA
- Certificates: X.509 certificates required for encryption/signing
- MDN: Supports both sync and async MDN modes
Example Partner AS2 Configuration
<!-- Partner's AS2 configuration -->
<AS2Configuration>
<PartnerID>YOUR-AS2-ID</PartnerID>
<URL>https://as2.as2aas.com/as2/receive</URL>
<Encryption>
<Algorithm>AES128_CBC</Algorithm>
<Certificate>your-public-cert.pem</Certificate>
</Encryption>
<Signing>
<Algorithm>SHA256withRSA</Algorithm>
<Certificate>partner-private-cert.pem</Certificate>
</Signing>
<MDN>
<Mode>async</Mode>
<URL>https://as2.as2aas.com/as2/mdn</URL>
</MDN>
</AS2Configuration>
Receiving Message Types
Supported Content Types
Content Type | Description | Use Case |
---|---|---|
application/edi-x12 | X12 EDI documents | Purchase orders, invoices |
application/edifact | EDIFACT documents | International EDI |
application/xml | XML business documents | Custom XML formats |
application/json | JSON documents | Modern API integration |
text/plain | Plain text files | Simple document exchange |
application/pdf | PDF documents | Reports, certificates |
Message Size Limits
Plan | Max Message Size |
---|---|
Free | 50 MB |
Starter | 100 MB |
Professional | 500 MB |
Enterprise | Custom |
Monitoring Incoming Messages
Via Dashboard
- Navigate to Messages in your dashboard
- Filter by Direction: Inbound
- View message status, payload, and MDN details
- Download original payloads
Via API
GET /v1/messages?direction=inbound
Via Webhooks
Configure webhook endpoints to receive real-time notifications:
{
"event": "message.received",
"data": {
"id": "msg_000001",
"message_id": "MSG_20240115_103000_ABC123",
"partner": {
"id": "prt_000001",
"name": "Acme Corp",
"as2_id": "ACME-CORP-AS2"
},
"status": "received",
"direction": "inbound",
"subject": "Purchase Order #67890",
"content_type": "application/edi-x12",
"bytes": 2048,
"received_at": "2024-01-15T10:30:00Z"
}
}
Error Handling
Common Receiving Errors
Error | Cause | Solution |
---|---|---|
PARTNER_NOT_FOUND | Unknown AS2-From ID | Add partner to your dashboard |
CERTIFICATE_INVALID | Invalid/expired certificate | Update partner certificate |
DECRYPTION_FAILED | Cannot decrypt message | Check encryption settings |
SIGNATURE_INVALID | Digital signature verification failed | Verify partner's signing certificate |
MESSAGE_TOO_LARGE | Message exceeds size limit | Upgrade plan or compress message |
Error Webhook Events
{
"event": "message.failed",
"data": {
"id": "msg_000001",
"status": "failed",
"error_code": "DECRYPTION_FAILED",
"error_message": "Unable to decrypt message with provided certificate",
"partner": {
"id": "prt_000001",
"as2_id": "ACME-CORP-AS2"
}
}
}
Testing Message Receiving
Using Sandbox
Simulate incoming messages for testing:
POST /v1/sandbox/incoming-message
{
"from_as2_id": "TEST-PARTNER",
"to_as2_id": "YOUR-AS2-ID",
"subject": "Test Purchase Order",
"payload": "ISA*00*...*IEA*1*000000001~",
"content_type": "application/edi-x12",
"encrypt": false,
"sign": true,
"request_mdn": true
}
Testing Tools Dashboard
Use the Testing Tools in your dashboard:
- Go to Testing Tools → Incoming Messages
- Configure test message parameters
- Load sample EDI or XML payloads
- Simulate message reception
- View results and generated MDNs
Security Considerations
Certificate Requirements
- Your Certificate: Upload your identity certificate for decryption
- Partner Certificates: Upload partner public certificates for signature verification
- Certificate Validation: All certificates are validated for expiry and chain of trust
Network Security
- HTTPS Only: All AS2 communication uses TLS 1.2+
- IP Allowlisting: Configure allowed IP ranges for partners (Enterprise)
- Rate Limiting: Automatic protection against message flooding
- Audit Logging: All receiving activity is logged for compliance
Troubleshooting
Message Not Received
- Check Partner Configuration: Verify AS2-To ID matches your configuration
- Verify Endpoint: Ensure partner is sending to
https://as2.as2aas.com/as2/receive
- Certificate Issues: Check certificate expiry and validity
- Network Issues: Verify partner can reach the endpoint
MDN Issues
- MDN Not Sent: Check if partner requested MDN in original message
- MDN Signature Failed: Verify your signing certificate is valid
- Async MDN Delivery: Check partner's MDN receiving endpoint
Getting Help
- Dashboard Logs: View detailed error logs in your dashboard
- Support: Contact support with message ID for investigation
- Testing Tools: Use sandbox to reproduce issues safely
Integration Examples
Processing Received Messages
// Webhook handler for received messages
app.post('/webhooks/as2', (req, res) => {
const { event, data } = req.body;
if (event === 'message.received') {
// Download and process the payload
const payloadResponse = await fetch(
`https://api.as2aas.com/v1/messages/${data.id}/payload`,
{
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
}
);
const payload = await payloadResponse.text();
// Process your EDI/XML document
await processBusinessDocument(payload, data);
}
res.status(200).send('OK');
});
Automatic Partner Setup
// Automatically add new partners when they send messages
app.post('/webhooks/as2', async (req, res) => {
const { event, data } = req.body;
if (event === 'partner.unknown') {
// Create partner automatically
await fetch('https://api.as2aas.com/v1/partners', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: `Auto-created: ${data.as2_id}`,
as2_id: data.as2_id,
url: data.return_url,
active: true
})
});
}
});