Quick Start Guide

Get started with AS2aaS in under 10 minutes. This guide will walk you through sending your first AS2 message.

Step 1: Create Your Account

  1. Sign up at as2aas.com
  2. Verify your email (if required)
  3. Access your dashboard

You'll automatically get:

  • ✅ Startup account (5,000 messages/month)
  • ✅ Default account with initial tenant
  • ✅ Access to testing tools
  • ✅ Master partner capabilities

Step 2: Generate API Keys

  1. Navigate to API Keys in your dashboard
  2. Click "Create API Key"
  3. Configure your key:
    • Name: "My First API Key"
    • Environment: Test (for development)
    • Scope: Account-Level (recommended for getting started)
    • Permissions: Full Access
  4. Copy your API key (starts with pk_test_)
Important: Save your API key securely. It won't be shown again.

Key Types

  • Account-Level Keys (pk_test_...): Access all tenants in your account, can manage master partners
  • Tenant-Level Keys (tk_test_...): Access single tenant only, inherits master partners

Step 3: Set Up Your First Partner

You can create partners at two levels:

  • Master Partners: Shared across all tenants in your account
  • Tenant Partners: Specific to individual tenants

Via Dashboard

  1. Go to Account → Master Partners in your dashboard
  2. Click "Add Master Partner"
  3. Fill in partner details:

Via API

curl -X POST https://api.as2aas.com/v1/accounts/{account}/partners \
  -H "Authorization: Bearer pk_test_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Test Partner",
    "as2_id": "TEST-PARTNER-001", 
    "url": "https://test-partner.example.com/as2",
    "sign": true,
    "encrypt": true,
    "mdn_mode": "async"
  }'

Create Tenant Partner (Alternative)

For tenant-specific partners, use the standard endpoint:

curl -X POST https://api.as2aas.com/v1/partners \
  -H "Authorization: Bearer pk_test_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Tenant Specific Partner",
    "as2_id": "TENANT-PARTNER-001", 
    "url": "https://tenant-partner.example.com/as2",
    "sign": true,
    "encrypt": true,
    "mdn_mode": "async"
  }'

Step 4: Send Your First Message

Using cURL

curl -X POST https://api.as2aas.com/v1/messages \
  -H "Authorization: Bearer pk_test_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: msg_first_test_001" \
  -d '{
    "partner_id": "prt_000001",
    "subject": "My First AS2 Message",
    "payload": {
      "content": "ISA*00*          *00*          *ZZ*SENDER         *ZZ*RECEIVER       *240115*1030*U*00401*000000001*0*T*>~GS*PO*SENDER*RECEIVER*20240115*1030*1*X*004010~ST*850*0001~BEG*00*SA*12345**20240115~N1*ST*SHIP TO LOCATION~PO1*1*10*EA*25.00**BP*PRODUCT123~CTT*1~SE*7*0001~GE*1*1~IEA*1*000000001~"
    },
    "content_type": "application/edi-x12"
  }'

Expected Response

{
  "message": "Message queued for delivery",
  "data": {
    "id": "msg_000001",
    "message_id": "MSG_20240115_103000_ABC123",
    "partner": {
      "id": "prt_000001", 
      "name": "Test Partner",
      "as2_id": "TEST-PARTNER-001"
    },
    "status": "queued",
    "direction": "outbound",
    "subject": "My First AS2 Message",
    "content_type": "application/edi-x12",
    "bytes": 284,
    "created_at": "2024-01-15T10:30:00Z"
  }
}

Step 5: Monitor Your Message

Check Message Status

curl -X GET https://api.as2aas.com/v1/messages/msg_000001 \
  -H "Authorization: Bearer pk_test_YOUR_API_KEY"

Message Status Progression

  1. queued → Message accepted and queued
  2. processing → Message being prepared
  3. sent → Message transmitted to partner
  4. delivered → MDN received (delivery confirmed)

In Test Environment

Since you're using a test API key, the message will be simulated:

  • Status will show as "sent"
  • No real transmission occurs
  • Perfect for development and testing

Step 6: Set Up Webhooks (Optional)

Create Webhook Endpoint

curl -X POST https://api.as2aas.com/v1/webhook-endpoints \
  -H "Authorization: Bearer pk_test_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://your-app.com/webhooks/as2",
    "events": ["message.sent", "message.delivered", "message.failed"],
    "secret": "your-webhook-secret"
  }'

Handle Webhook Events

// Express.js webhook handler
app.post('/webhooks/as2', express.raw({type: 'application/json'}), (req, res) => {
  const event = JSON.parse(req.body);
  
  console.log('Received event:', event.event);
  console.log('Message ID:', event.data.id);
  
  // Process the event
  switch (event.event) {
    case 'message.sent':
      console.log('Message sent successfully');
      break;
    case 'message.delivered':
      console.log('Message delivered, MDN received');
      break;
    case 'message.failed':
      console.log('Message failed:', event.data.error_message);
      break;
  }
  
  res.status(200).send('OK');
});

Next Steps

1. Test Message Receiving

Configure a test partner to send messages to your AS2 endpoint:

Your AS2 Receiving Endpoint:

https://as2.as2aas.com/as2/receive

Your AS2 ID: Found in your dashboard settings

2. Upload Certificates

For production use, upload X.509 certificates:

  1. Identity Certificate - Your private certificate for signing/decryption
  2. Partner Certificates - Partners' public certificates for encryption/verification

3. Go Live

When ready for production:

  1. Create live API key in your dashboard
  2. Update your application to use live key
  3. Configure real trading partners
  4. Upload production certificates
  5. Test thoroughly before processing real business documents

Common Integration Patterns

ERP Integration

// Integrate with your ERP system
async function sendInvoiceToPartner(invoice) {
  // Convert invoice to EDI format
  const ediContent = convertToEDI(invoice);
  
  // Send via AS2aaS
  const message = await as2.messages.create({
    partner: invoice.partner_as2_id,
    subject: `Invoice ${invoice.number}`,
    payload: { content: ediContent },
    contentType: 'application/edi-x12'
  });
  
  // Update invoice status
  await updateInvoiceStatus(invoice.id, 'sent', message.id);
  
  return message;
}

Automated Processing

// Process incoming purchase orders automatically
app.post('/webhooks/as2', async (req, res) => {
  const { event, data } = req.body;
  
  if (event === 'message.received' && data.content_type === 'application/edi-x12') {
    // Download EDI content
    const ediContent = await as2.messages.getPayload(data.id);
    
    // Parse EDI
    const purchaseOrder = parseEDI850(ediContent);
    
    // Create order in your system
    const order = await createOrder({
      partner_id: data.partner.as2_id,
      external_id: purchaseOrder.orderNumber,
      items: purchaseOrder.items,
      as2_message_id: data.id
    });
    
    console.log('Created order:', order.id);
  }
  
  res.status(200).send('OK');
});

Testing and Development

Using the Sandbox

The AS2aaS testing tools provide a complete sandbox environment:

  1. Testing Tools → Test partner connectivity
  2. Message Validation → Validate EDI/XML formats
  3. Incoming Messages → Simulate messages from partners
  4. Test History → Review all test results

Sample EDI Content

ISA*00*          *00*          *ZZ*SENDER         *ZZ*RECEIVER       *240115*1030*U*00401*000000001*0*T*>~
GS*PO*SENDER*RECEIVER*20240115*1030*1*X*004010~
ST*850*0001~
BEG*00*SA*PO-2024-001**20240115~
N1*ST*SHIP TO LOCATION~
N3*123 MAIN STREET~
N4*ANYTOWN*NY*12345~
PO1*1*10*EA*25.00**BP*PRODUCT123*SK*SKU123~
CTT*1~
SE*8*0001~
GE*1*1~
IEA*1*000000001~

Sample XML Content

<?xml version="1.0" encoding="UTF-8"?>
<PurchaseOrder>
  <Header>
    <OrderNumber>PO-2024-001</OrderNumber>
    <OrderDate>2024-01-15</OrderDate>
    <Vendor>
      <Name>Supplier Corp</Name>
      <AS2ID>SUPPLIER-AS2</AS2ID>
    </Vendor>
  </Header>
  <LineItems>
    <Item>
      <SKU>PROD-001</SKU>
      <Description>Product 1</Description>
      <Quantity>10</Quantity>
      <UnitPrice>25.00</UnitPrice>
    </Item>
  </LineItems>
</PurchaseOrder>

Troubleshooting

Common First-Time Issues

"Partner not found" error:

  • Verify partner ID format: prt_000001
  • Check partner exists in your account
  • Ensure partner is active

"Invalid payload" error:

  • Validate EDI/XML format
  • Check content type matches payload
  • Verify payload encoding

"Rate limited" error:

  • Slow down request frequency
  • Check your plan limits
  • Implement retry logic

Getting Help

  • Documentation: Complete API reference and guides
  • Testing Tools: Built-in dashboard testing tools
  • Support: Email [email protected]
  • Status: Check system status at status.as2aas.com

What's Next?

Advanced Features

Production Readiness

Integration Examples