# How to Connect UPS

## Overview

Automation Studio supports UPS integration for creating shipments and tracking packages via the UPS API.

## Step 1: Get UPS API Credentials

1. Go to [UPS Developer Portal](https://developer.ups.com/)
2. Create a developer account
3. Create a new application
4. Get your API Key (Access Key)
5. Get your Username and Password
6. Note your Account Number

## Step 2: Add Integration in Automation Studio

1. Open Automation Studio
2. Click the **🔗 Registry** button (top-right)
3. Click **+ Add Integration**
4. Select **UPS** as the provider
5. Enter a name (e.g., "Main Shipping Account")
6. Enter your UPS API credentials:
   - Access Key (API Key)
   - Username
   - Password
   - Account Number
7. Click **Save**
8. Click **Test** to verify the connection

## Step 3: Use in Flows

1. In Flow Builder, add a **Vendor** node
2. In the node configuration:
   - Select **UPS** as the vendor provider
   - Select your UPS integration from the dropdown
   - Choose operation:
     - **createShipment**: Create a new shipment
     - **getShipmentStatus**: Get status of existing shipment
     - **trackPackage**: Track a package by tracking number
3. Configure operation-specific fields:
   - For createShipment: toAddress, fromAddress, weight, dimensions
   - For getShipmentStatus: shipmentId
   - For trackPackage: trackingNumber
4. Save and test your flow

## Example Flow

**Order → Shipment Workflow:**
1. Trigger: Webhook (order created)
2. Vendor Node: UPS createShipment
   - Uses order data (address, items)
   - Returns tracking number
3. Email Node: Send tracking email to customer
4. Firestore Node: Update order with tracking number

## Testing

Use the **Test** button in the Integrations page to verify UPS API connection.

## Troubleshooting

- **Invalid credentials**: Verify API key, username, and password
- **Account not found**: Check account number
- **Rate limit exceeded**: UPS has rate limits; implement retry logic

## Security

- API credentials stored securely in encrypted vault
- Never expose credentials in logs
- Rotate credentials periodically

