What Is an API Integration? A Guide to API Integrations
Learn what API integration means, how requests, authentication, mapping and retries work, and how to build reliable connections.
Direct answer: An API integration is a built and maintained connection that uses an application programming interface (API) to let two or more systems exchange data or functionality. The API defines communication rules; the integration is the code, configuration, authentication, mapping, error handling and operations that make those rules work in a real workflow. Having an API does not mean two products are already connected.
For example, an online store can call a payment API, receive an authorization response and write the result to its order system. The payment API is the interface. The integration is the working sequence that sends the request, authenticates it, maps fields, handles failures and records the response.
What is API integration?
API integration connects applications, data or workflows across teams, cloud services and on-premises systems. Common examples include payments, mapping and geolocation, messaging, cloud services, CRM and ERP synchronization, and collaboration tools. IBM describes these as ways to move data or functionality between systems, while SAP distinguishes an API capability from the integration implementation.
API versus API integration
| Term | Meaning | What is built |
|---|---|---|
| API | An agreed interface covering endpoints, methods, fields, authentication and responses. | The provider publishes and operates the interface. |
| API integration | A working connection that uses one or more APIs in a business process. | Requests, credentials, transformations, retries, storage, monitoring and ownership. |
| API management | Lifecycle controls for creating, publishing, securing, sharing and tracking APIs. | Policies, catalogs, gateways, analytics and governance. It supports integration but is not the integration itself. |
How an API integration works
- A trigger occurs, such as a user action, schedule, webhook or new record.
- The client builds an HTTP request with the method, URL, headers, query parameters and body required by the API.
- The client authenticates with an API key, OAuth token, signed request or another documented mechanism.
- The receiving service validates permissions and input, executes the operation and returns a status code and response.
- The integration parses the response, maps fields into the destination system and records an outcome.
- Failures are classified, logged and retried only when the operation makes that safe; permanent errors go to an alert or dead-letter workflow.
In an API Gateway architecture, the integration request can pass or transform client data before calling a Lambda function, HTTP endpoint or cloud action. The integration response can map backend output into the response sent to the client. AWS documents these request and response mappings.
Plan the integration before writing code
- Define the data flow. List the source, destination, records or actions, direction, trigger and desired result. Decide whether the flow is synchronous or asynchronous.
- Read the API contract. Record endpoints, methods, required fields, response formats, pagination, rate limits, timeouts, version policy and sandbox behavior.
- Choose an identity. Use a dedicated service account with least-privilege permissions. Store secrets in a secret manager or environment configuration.
- Define mappings and invariants. Document source field, destination field, type conversion, defaults, null handling, units, time zones and idempotency keys.
- Design failure behavior. Separate validation errors, authentication failures, permission errors, rate limits, transient server errors, timeouts and malformed responses.
- Choose an implementation style. An SDK gives reusable request and parsing code. Custom HTTP code gives control but requires more maintenance. An integration platform (iPaaS) can coordinate many applications and workflows. Postman outlines these trade-offs.
- Set ownership and governance. Name the owner, document the flow, define deployment and rollback, and decide how API changes are detected.
Build a minimal HTTP integration
The following example calls a hypothetical JSON endpoint. Replace the URL, fields and authentication scheme with the provider’s documented values.
curl -X POST 'https://api.example.com/v1/orders' \
-H 'Authorization: Bearer $API_TOKEN' \
-H 'Content-Type: application/json' \
--data '{"customer_id":"cus_123","amount":4200,"currency":"USD"}'
import os
import requests
payload = {"customer_id": "cus_123", "amount": 4200, "currency": "USD"}
r = requests.post(
"https://api.example.com/v1/orders",
headers={"Authorization": f"Bearer {os.environ['API_TOKEN']}"},
json=payload,
timeout=30,
)
r.raise_for_status()
order = r.json()
print(order["id"])
const token = process.env.API_TOKEN;
const res = await fetch('https://api.example.com/v1/orders', {
method: 'POST',
headers: {
authorization: `Bearer ${token}`,
'content-type': 'application/json'
},
body: JSON.stringify({ customer_id: 'cus_123', amount: 4200, currency: 'USD' })
});
if (!res.ok) throw new Error(`API returned ${res.status}: ${await res.text()}`);
const order = await res.json();
console.log(order.id);
Production code should validate inputs and response schemas, redact secrets and personal data from logs, attach a correlation ID, enforce a finite timeout and persist enough context to replay a failed operation safely.
Authentication, permissions and security
- Follow the provider’s documented authentication flow; do not assume an API key and OAuth token are interchangeable.
- Grant only the scopes and resources the integration needs. Rotate credentials and revoke unused ones.
- Use TLS, validate hostnames and avoid disabling certificate verification.
- Keep secrets outside repositories, client-side bundles and error messages.
- Validate and constrain data before sending it. Treat API responses as untrusted input.
- Use separate credentials and endpoints for development, staging and production.
- Record configuration changes and monitor authentication failures and unusual request volume.
AWS API Gateway guidance also emphasizes authentication, monitoring and permissions to reach a backend.
Mapping, idempotency and asynchronous work
Field mapping
Document every conversion: cents to dollars, local time to UTC, provider status values to your internal enum, and missing fields to explicit nulls. Reject ambiguous data instead of silently guessing.
Idempotency
For create or charge operations, send a provider-supported idempotency key when available. Store the key and result so a timeout can be retried without creating a duplicate. If the API has no idempotency feature, use a unique business key and destination-side deduplication.
Webhooks and jobs
Verify webhook signatures, accept events quickly, persist them before processing and make handlers safe to replay. For long operations, return a job ID, poll at a documented interval or consume a signed callback, and expose status to operators.
Retries, rate limits and reliability
| Symptom | Typical handling |
|---|---|
| 400–422 validation error | Fix the payload; do not retry unchanged data. |
| 401 authentication error | Refresh or rotate credentials and verify the environment. |
| 403 permission error | Request the required scope or resource permission. |
| 409 conflict or duplicate | Read the conflict response and apply idempotency or reconciliation. |
| 429 rate limit | Honor Retry-After when present; use bounded exponential backoff and a queue. |
| 5xx, network error or timeout | Retry only idempotent or safely deduplicated operations, with a cap and jitter. |
Use circuit breakers or queue-based buffering when a dependency is unhealthy. Alert on sustained failures, rising latency, authentication errors, rate-limit responses and data drift. Reconcile source and destination periodically so a missed event does not become permanent loss.
Performance, scale and cost
- Measure end-to-end latency, dependency latency, throughput, error rate, retry count and queue age.
- Reuse HTTP connections, request only needed fields, paginate deliberately and cache safe read responses.
- Use batching or bulk endpoints when documented; respect payload and rate limits.
- Bound concurrency. More parallel requests can increase throttling and failure rates.
- Choose synchronous calls for short user-visible actions and asynchronous jobs for long or bursty work.
- Estimate provider request charges, compute, storage, egress, observability and support costs.
There is no universal cheapest or fastest integration method. Compare SDK, custom code and an integration platform against customization, upkeep, skills, security, governance, number of systems and expected scale.
Testing and operations checklist
- Contract tests cover required request fields and response schemas.
- Sandbox tests cover success, validation, authentication, permission, rate-limit, timeout and duplicate cases.
- Replay tests prove webhook and retry handlers are idempotent.
- Load tests stay within documented limits and observe queue behavior.
- Dashboards show volume, latency, status classes, retries and reconciliation gaps.
- Runbooks include credential rotation, rollback, replay, backfill and provider-incident steps.
- Pin dependency versions, review API deprecations and update mapping documentation.
Common errors and fixes
| Error | Cause | Fix |
|---|---|---|
| 401/403 | Wrong token, expired credential or missing scope. | Inspect the environment, refresh credentials and grant the minimum required permission. |
| 400/422 | Missing, mis-typed or invalid field. | Compare the serialized request with the schema; validate before sending. |
| 429 | Quota or concurrency limit. | Honor Retry-After, reduce concurrency and queue work. |
| Timeout | Slow dependency, network path or too-short client timeout. | Set a finite timeout, capture a correlation ID and retry only safe operations. |
| Duplicate records | Retry after an unknown outcome without idempotency. | Use an idempotency key or reconciliation lookup before retrying. |
| Malformed JSON | Unexpected content type, proxy error page or provider change. | Check status and Content-Type before parsing; retain a redacted response sample. |
| Works locally, fails in production | Different credentials, network allowlist, clock, region or API version. | Compare configuration and outbound network policy, then test the production path safely. |
Example: integrating a screenshot API
A screenshot API is an API integration when your application sends a URL and capture options, then stores or serves the returned image or PDF. Your integration still owns authentication, retries, naming, retention and downstream processing.
DIY request flow
- Validate and normalize the target URL.
- Call the screenshot service with an explicit timeout.
- Check status and content type before writing bytes.
- Store the object with a deterministic key and metadata.
- Retry only safe failures and record provider response data for diagnostics.
curl -G 'https://example-screenshot.test/v1/shot' \
-d 'access_key=$API_KEY' \
--data-urlencode 'url=https://example.com' \
-o page.png
Or skip the browser setup
ScreenshotNeo provides a single GET request that returns a PNG, JPEG, WebP or PDF. Before capture it accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups and chat widgets; each step can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and the response identifies the page verdict and billing with X-Page-Verdict and X-Billed headers. See the ScreenshotNeo API docs for all options.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
It also supports full-page capture with lazy images loaded, CSS-selector element capture, dark mode, 12 device presets or any viewport, retina scale, PDF paper size, margins, landscape and page ranges, HTML/CSS to image, custom CSS and JavaScript, pre-capture clicks, hidden selectors, waits, request blocking, custom headers, cookies, user agents and Authorization, timezone and geolocation, transparent backgrounds, resizing, chosen cache TTL, signed links, asynchronous jobs with signed webhooks, bulk capture of 100 URLs per call, a usage API and an OpenAPI spec. Parameter names used by other screenshot APIs also work.
An MCP server exposes take_screenshot, get_page_info and capture_pdf to Claude, Cursor and other MCP clients. Plans include 1,000 free shots per month with no card; paid plans start at $5 for 3,000 shots, and every feature is on every plan. Create a free ScreenshotNeo account.
FAQ
Is an API integration just an API call?
A call is one request. An integration includes the surrounding configuration, mapping, authentication, error handling, storage, monitoring and maintenance needed for a dependable workflow.
Should I use an SDK or direct HTTP?
Use an SDK for reusable provider conventions and parsing. Use direct HTTP when you need control or the provider has no suitable SDK. Evaluate maintenance and security either way.
When should an integration be asynchronous?
Use a job or event flow when work is slow, bursty, retryable or does not need to block a user request.
How do I know an integration is healthy?
Track successful and failed requests, latency, retries, rate limits, queue age, reconciliation gaps and schema changes, with alerts and a runbook.


