OilPriceAPI Documentation
GitHub
GitHub
  • Guides

    • Authentication
    • Testing & Development
    • Error Codes Reference
    • Webhook Signature Verification
    • Production Deployment Checklist
    • Service Level Agreement (SLA)
    • Rate Limiting & Response Headers
    • Data Quality and Validation
    • Troubleshooting Guide
    • Incident Response Guide

Production Deployment Checklist

Complete checklist for deploying OilPriceAPI integration to production.

Pre-Production Requirements

✅ Account Setup

  • [ ] Production account created at oilpriceapi.com
  • [ ] Email verified and account activated
  • [ ] Billing information added (required for paid plans)
  • [ ] Appropriate plan selected based on usage requirements
  • [ ] Company information updated in dashboard
  • [ ] Tax information provided (if applicable)

✅ API Key Management

  • [ ] Production API key generated (opa_live_*)
  • [ ] Key stored securely (not in code repository)
  • [ ] Environment variables configured
    # Production environment
    OILPRICE_API_KEY=opa_live_YOUR_PRODUCTION_KEY
    OILPRICE_BASE_URL=https://api.oilpriceapi.com/v1
    
  • [ ] Key rotation schedule established (recommended: quarterly)
  • [ ] Backup key generated for emergency failover
  • [ ] Access controls implemented (who can access keys)

Implementation Checklist

✅ Core Integration

  • [ ] Authentication implemented correctly
    // Correct format
    headers: { 'Authorization': 'Token ' + process.env.OILPRICE_API_KEY }
    
  • [ ] Base URL configured for production
    const BASE_URL = 'https://api.oilpriceapi.com/v1';
    
  • [ ] Response parsing handles all fields
    // Correct structure
    const price = data.data.WTI_USD.price;  // Not data.prices.WTI_USD.value
    
  • [ ] All commodity codes validated

✅ Error Handling

  • [ ] All error codes handled (see Error Codes Guide)
  • [ ] Retry logic implemented for transient failures
    def make_request_with_retry(url, headers, max_retries=3):
        for attempt in range(max_retries):
            response = requests.get(url, headers=headers)
    
            if response.status_code == 429:  # Rate limited
                time.sleep(int(response.headers.get('Retry-After', 60)))
                continue
            elif response.status_code >= 500:  # Server error
                time.sleep(2 ** attempt)  # Exponential backoff
                continue
    
            return response
        raise Exception("Max retries exceeded")
    
  • [ ] Graceful degradation for API failures
  • [ ] User-friendly error messages (not raw API errors)
  • [ ] Circuit breaker pattern for repeated failures

✅ Rate Limiting

  • [ ] Rate limit headers monitored
    const remaining = response.headers.get('X-RateLimit-Remaining');
    const resetTime = response.headers.get('X-RateLimit-Reset');
    
  • [ ] Request throttling implemented if needed
  • [ ] Monthly quota tracking in place
  • [ ] Alerts configured for approaching limits
  • [ ] Backoff strategy for rate limit errors

✅ Performance Optimization

  • [ ] Response caching implemented where appropriate
    const cache = new Map();
    const CACHE_TTL = 300000; // 5 minutes
    
    function getCachedPrice(commodity) {
        const cached = cache.get(commodity);
        if (cached && Date.now() - cached.timestamp < CACHE_TTL) {
            return cached.data;
        }
        return null;
    }
    
  • [ ] Connection pooling configured
  • [ ] Request batching for multiple commodities
  • [ ] Unnecessary API calls eliminated
  • [ ] Response time monitoring in place

✅ Security

  • [ ] API keys not in source control
  • [ ] HTTPS enforced for all API calls
  • [ ] Input validation before API requests
  • [ ] Output sanitization before displaying
  • [ ] Rate limiting on your endpoints
  • [ ] API key rotation process documented
  • [ ] Audit logging for API usage
  • [ ] No sensitive data in logs

Monitoring & Observability

✅ Logging

  • [ ] Request logging implemented
    import logging
    
    def log_api_request(endpoint, params, response):
        logging.info({
            'timestamp': datetime.utcnow().isoformat(),
            'endpoint': endpoint,
            'params': params,
            'status': response.status_code,
            'request_id': response.headers.get('X-Request-Id'),
            'remaining': response.headers.get('X-RateLimit-Remaining')
        })
    
  • [ ] Error logging with context
  • [ ] Performance metrics tracked
  • [ ] Log retention policy configured
  • [ ] Log analysis tools set up

✅ Monitoring

  • [ ] Uptime monitoring configured
  • [ ] Response time alerts set up
  • [ ] Error rate monitoring active
  • [ ] API quota dashboard created
  • [ ] Cost tracking implemented
  • [ ] Business metrics tracked (conversions, usage patterns)

✅ Alerting

  • [ ] Critical error alerts configured
    • API authentication failures
    • Rate limit exceeded
    • Service unavailable (5xx errors)
    • Quota approaching limit
  • [ ] Alert escalation defined
  • [ ] On-call rotation (if applicable)
  • [ ] Runbook for common issues

Testing in Production

✅ Smoke Tests

  • [ ] Basic connectivity test
    curl -I https://api.oilpriceapi.com/v1/prices/latest \
      -H "Authorization: Token $OILPRICE_API_KEY"
    
  • [ ] Key commodity prices retrievable
  • [ ] Error handling works as expected
  • [ ] Rate limiting behaves correctly
  • [ ] Fallback mechanisms tested

✅ Load Testing

  • [ ] Expected load tested
  • [ ] Peak load scenarios validated
  • [ ] Rate limit behavior under load verified
  • [ ] Graceful degradation confirmed
  • [ ] Recovery from failures tested

✅ Integration Tests

  • [ ] End-to-end workflows tested
  • [ ] Data accuracy verified
  • [ ] Time zone handling correct
  • [ ] Historical data retrieval works

Webhook Configuration (If Applicable)

✅ Webhook Setup

  • [ ] Webhook endpoint deployed and accessible
  • [ ] HTTPS enforced on webhook endpoint
  • [ ] Signature verification implemented (see Webhook Verification Guide)
  • [ ] Idempotency handled
  • [ ] Quick response (<5 seconds)
  • [ ] Async processing for heavy operations
  • [ ] Error handling and retries configured

Documentation & Knowledge Transfer

✅ Internal Documentation

  • [ ] API integration documented
  • [ ] Configuration guide created
  • [ ] Troubleshooting guide written
  • [ ] Runbook for common issues
  • [ ] Architecture diagram updated
  • [ ] Data flow documented

✅ Team Preparation

  • [ ] Team trained on API integration
  • [ ] Support contacts documented
  • [ ] Escalation path defined
  • [ ] Dashboard access granted to relevant team members
  • [ ] Monitoring access configured

Go-Live Checklist

✅ Final Verification

  • [ ] All tests passing in production environment
  • [ ] Monitoring active and verified
  • [ ] Alerts tested and working
  • [ ] Rollback plan documented and tested
  • [ ] Support ticket opened (if launching during business hours)
  • [ ] Stakeholders notified of go-live time

✅ Launch Day

  • [ ] Gradual rollout (if possible)
    • [ ] 10% of traffic first
    • [ ] Monitor for 1 hour
    • [ ] 50% of traffic
    • [ ] Monitor for 2 hours
    • [ ] 100% of traffic
  • [ ] Monitor key metrics closely
    • API response times
    • Error rates
    • Business metrics
  • [ ] Support team on standby
  • [ ] Communication channels open

✅ Post-Launch (First 24 Hours)

  • [ ] No critical errors observed
  • [ ] Performance metrics within expected range
  • [ ] Rate limits not exceeded
  • [ ] User feedback collected
  • [ ] Cost tracking verified
  • [ ] Success metrics measured

Rollback Plan

✅ Rollback Triggers

Define conditions that trigger rollback:

  • [ ] Error rate >5% for 5 minutes
  • [ ] Response time >2 seconds for 10 minutes
  • [ ] Authentication failures >10 per minute
  • [ ] Critical business function impaired

✅ Rollback Process

  1. Immediate Actions

    # Switch to fallback/previous version
    kubectl rollout undo deployment/api-integration
    # or
    git revert HEAD && git push origin main
    
  2. Notification

    • Alert team via Slack/PagerDuty
    • Update status page
    • Notify stakeholders
  3. Post-Rollback

    • Root cause analysis
    • Fix identified issues
    • Plan retry with fixes

Optimization Checklist (Post-Launch)

✅ Week 1 Review

  • [ ] Usage patterns analyzed
  • [ ] Cache hit rates optimized
  • [ ] Unnecessary requests identified and eliminated
  • [ ] Error patterns reviewed
  • [ ] Cost optimization opportunities identified

✅ Month 1 Review

  • [ ] Plan adequacy assessed (upgrade needed?)
  • [ ] Performance benchmarks established
  • [ ] Integration improvements identified
  • [ ] Team feedback collected
  • [ ] Documentation updated based on learnings

Support & Escalation

Contact Information

Regular Support

  • Email: [email protected]
  • Response time: 3 business days
  • Include: Account email, API key prefix (first 8 chars), error details

Urgent Issues (Enterprise customers)

  • Contact your account manager
  • Include request_id from error responses

Useful Resources

  • API Documentation
  • Status Page
  • Dashboard
  • Error Codes Reference
  • Testing Guide

Sign-off

Deployment Approval

  • [ ] Technical Lead approval
  • [ ] Security review completed
  • [ ] Performance testing signed off
  • [ ] Business stakeholder approval
  • [ ] Go-live date/time confirmed

Note: This checklist should be customized based on your specific requirements, architecture, and compliance needs. Not all items may apply to your implementation.

Last Updated: 9/23/25, 7:58 PM
Prev
Webhook Signature Verification
Next
Service Level Agreement (SLA)