Skip to main content

HTTP Request Step

The HTTP Request step calls external APIs and web services. Use it to fetch data, send notifications, update external systems, or integrate with any service that has a REST API. Unlike agent tools (which agents use intelligently), HTTP Request gives you explicit control over API calls.
When to use HTTP Request vs. Agent Tools: Use HTTP Request when you need explicit control over the API call (specific endpoint, exact parameters, precise error handling). Use Agent Tools when you want the agent to intelligently decide when and how to call APIs.

How HTTP Requests Work

HTTP Requests send data to external endpoints and return responses that subsequent steps can use:

Configuration

Request Settings

method
enum
required
HTTP methodOptions:
  • GET - Retrieve data (most common)
  • POST - Create new resource or submit data
  • PUT - Update existing resource (replace)
  • PATCH - Update existing resource (modify)
  • DELETE - Remove resource
  • HEAD - Get headers only (no body)
  • OPTIONS - Check allowed methods
Examples:
  • GET: Fetch user profile, list orders
  • POST: Create customer, send notification
  • PUT: Update entire record
  • PATCH: Update specific fields
  • DELETE: Remove item, cancel subscription
url
string
required
API endpoint URLCan include variables from previous steps:
Best practices:
  • Always use HTTPS (not HTTP)
  • Include API version in URL if available
  • Verify URL is correct before deploying
headers
object
Request headersCommon headers:
Can include variables:
body
object
Request body (for POST, PUT, PATCH)JSON body:
Can reference entire objects:
Note: Body is automatically JSON-encoded. For form-data or other formats, use appropriate Content-Type header.
queryParams
object
URL query parametersExample:
Automatically appended to URL:
Can use variables:

Authentication

authentication
object
Authentication configurationTypes:
Most common for modern APIs
Adds header: Authorization: Bearer <token>
Security: Store API keys and secrets in Secrets Manager, not directly in flows. Reference them with ${secrets.key_name}.

Response Handling

Response Structure

HTTP Request returns:

Accessing Response Data

Reference response in subsequent steps:

Error Handling

retryConfig
object
Automatic retry configuration
Settings:
  • maxRetries: Number of retry attempts
  • retryDelay: Initial delay between retries (ms)
  • retryOn: Status codes that trigger retry
  • backoffMultiplier: Increase delay each retry (exponential backoff)
Example: First retry after 1s, second after 2s, third after 4s
timeout
number
default:"30000"
Request timeout in millisecondsRequest fails if no response within timeout period.Recommendations:
  • Fast APIs: 5000ms (5 seconds)
  • Standard APIs: 30000ms (30 seconds)
  • Slow APIs: 60000ms (60 seconds)
  • Long operations: 120000ms+ (2+ minutes)
failOn
array
Status codes that should be treated as failures
By default, only 5xx codes fail. Use this to also fail on specific 4xx codes.

Error Response

When request fails:
Access in conditions:

Common Patterns

Get external data before agent processes
Use when: Agent needs context from external systems
Agent generates content, HTTP sends to external system
Use when: Agent creates content for external systems
Chain multiple API calls using previous responses
Use when: Need data from multiple endpoints
Call multiple APIs simultaneously (not sequential)
Use when: Need data from multiple sources, order doesn’t matterNote: Configure parallel execution in flow settings
Respond to webhook with HTTP call
Use when: Webhook requires acknowledgment
Retry failed requests with backoff
Use when: External APIs may have temporary failures
Check and respect rate limits
Use when: API has rate limits you need to respect
Iterate through paginated results
Use when: API returns paginated results

Real-World Examples

Example 1: CRM Contact Creation

Scenario: Create or update contact in CRM after agent qualifies lead

Example 2: Slack Notification

Scenario: Send notification to Slack when high-value order placed

Example 3: Email via SendGrid

Scenario: Send personalized email after agent generates content

Example 4: Database Query via API

Scenario: Query database for customer order history

Example 5: Payment Processing

Scenario: Process payment through Stripe

Best Practices

Use HTTPS

Always use HTTPS endpoints (not HTTP) for security. API keys and data are encrypted in transit.

Store Secrets Securely

Never hardcode API keys. Use Secrets Manager and reference with ${secrets.key_name}.

Handle Errors

Always add error handling with Conditions. Check status codes and have fallback flows.

Set Appropriate Timeouts

Set timeouts based on expected API response time. Don’t leave default if API is slow.

Use Retry for Transient Failures

Enable retry for 5xx errors and network issues. Use exponential backoff to avoid overwhelming APIs.

Validate Responses

Check that response has expected structure before using data. Use Conditions to verify.

Respect Rate Limits

Check rate limit headers. Add delays if approaching limits.

Log for Debugging

Monitor HTTP requests in flow execution logs. Review failures to improve error handling.

Troubleshooting

Causes:
  • API key missing or incorrect
  • Token expired
  • Wrong authentication type
Solutions:
  • Verify API key in Secrets Manager
  • Check authentication configuration
  • Regenerate API key if needed
  • For OAuth, check token expiration
Causes:
  • Wrong URL or endpoint
  • Resource doesn’t exist
  • Variable in URL not populated
Solutions:
  • Double-check URL spelling
  • Verify endpoint in API docs
  • Check variable references: ${trigger.id} not ${id}
  • Test URL manually in browser/Postman
Causes:
  • API is down
  • Invalid request body
  • Server-side bug
Solutions:
  • Check API status page
  • Verify request body structure
  • Enable retries for transient failures
  • Contact API provider if persistent
Causes:
  • API too slow
  • Timeout too short
  • Network issues
Solutions:
  • Increase timeout setting
  • Check API performance/status
  • Optimize API call (reduce data)
  • Use async/background processing if possible
Causes:
  • Wrong variable path
  • Response not JSON
  • API returned error
Solutions:
  • Check execution logs for actual response
  • Verify response is JSON (Content-Type: application/json)
  • Check for error response instead of success
  • Try ${http.rawBody} to see exact response
Note: CORS errors don’t apply to QuivaWorks flows (server-side). If you see CORS errors:
  • You’re likely testing from browser console
  • Flows run server-side and don’t have CORS restrictions
  • The API might not allow your testing origin
Solution: CORS won’t affect production flows. Ignore when testing server-side.

Security Best Practices

Do:
  • Store keys in Secrets Manager
  • Rotate keys regularly (every 90 days)
  • Use separate keys for dev/staging/prod
  • Revoke immediately if compromised
  • Monitor key usage
Don’t:
  • Hardcode keys in flows
  • Share keys in chat or email
  • Use same key across environments
  • Commit keys to version control
Always validate and sanitize user input before including in API calls:
Never pass raw user input directly to APIs without validation.
Implement your own rate limiting:
  • Track API calls per user/session
  • Add delays if approaching limits
  • Cache responses when possible
  • Use webhooks instead of polling
Don’t expose sensitive information in errors:Bad:
Good:

Next Steps

Condition Step

Handle HTTP response with conditions

Map Step

Transform API responses

Agent Tools

Let agents call APIs intelligently

Secrets Manager

Store API keys securely