Homeglossary

API response

An API response is a software message that a server sends back after an application makes an API request. It states whether the request succeeded and may include data, instructions, or error details. In web APIs, the response commonly contains an HTTP status code, headers, and an optional body, often formatted as JSON.

Build and test API responses with Emergent.

What is an API response?

An API response is a software message a server sends after an application makes an API request. It reports the result and may return data or an error.

How an API request and response work

  1. A client calls an API endpoint.
  2. The server authenticates, validates, and performs work.
  3. It returns a status, headers, and optional body.

The three parts of an HTTP API response

PartPurposeExample
StatusOutcome200 OK
HeadersMetadataContent-Type: JSON
BodyData or error details{"name":"Sam"}

A body is optional, including with 204 No Content.

Common API response status codes

CodeMeaning
200, 201, 204Success, created, or no content
400, 401, 403, 404Bad request, missing login, forbidden, or absent resource
422, 429, 500Invalid valid-format input, rate limit, or server failure

How to read an API response

  1. Check the status code.
  2. Inspect headers, including request IDs.
  3. Safely parse the body.
  4. Match errors to API documentation.

Benefits of clear API responses

  • They enable useful messages and dependable testing.
  • They help apps recover from temporary failures.

Practical limits and common API response mistakes

  • Do not expose secrets or internal stack traces.
  • Do not retry every error or assume success includes data.
  • Include pagination details for long lists.

API response design tips

  • Use standard HTTP meanings and stable JSON fields.
  • Return machine-readable codes and clear messages.
  • Document cursors and rate-limit headers.

API responses in Emergent

Emergent can build full-stack apps that call services, use API authentication, handle success and failure states, and test integrations. See how this works in a Gmail API tutorial. Build and test API responses with Emergent.

Frequently Asked Questions

Your Questions, Answered

This will automatically populate, don't change

Don't change this element unless you know what you are doing

What is a 422 API response?

A 422 Unprocessable Content response means the server understood the request format but cannot process the submitted values, such as an invalid email address.

What does an API response error mean?

It means the server could not complete the request as expected. Check the status code, response body, and request ID to identify the cause.

What is a 200 response from an API?

200 OK means the request succeeded. The response often includes data, but its exact meaning depends on the API documentation.

What does a 404 response mean in an API?

404 Not Found means the requested endpoint or resource does not exist at the specified URL.

What is the difference between an HTTP 204 response and a 404 response?

204 No Content means the request succeeded but has no response body. 404 means the requested resource or endpoint was not found.

What is the difference between a 400 response and a 404 response?

400 Bad Request means the request itself is malformed or invalid. 404 Not Found means the requested URL or resource is unavailable.

How do you validate the response code in API testing?

Send a known request, assert the expected HTTP status code, then verify relevant headers and body fields. Test both valid and invalid inputs.

How do you check an API response in Chrome?

Open Chrome DevTools, select Network, repeat the action, choose the request, and inspect the Headers, Preview, and Response panels.

Start Building
on Emergent today
Start Building