Data Formats
API
An API (Application Programming Interface) is a defined contract that lets one piece of software request data or actions from another without knowing how it works internally.
Updated 12 Aug 2026
A contract between programs
An API is the published surface of a system: the endpoints you may call, the inputs they accept and the outputs they promise. Everything behind that surface — the language, database and deployment — can change freely as long as the contract holds.
On the web, most APIs speak HTTP and exchange JSON. A client sends a method (GET, POST, PUT, DELETE), a path, headers and often a body; the server replies with a status code and a body. REST organises those calls around resources; GraphQL exposes a single endpoint and lets the client describe exactly which fields it wants.
Anatomy of a request
| Part | Purpose |
|---|---|
| Method | The intent: read, create, replace or delete |
| Path | Which resource is being addressed |
| Headers | Content type, authentication token, caching hints |
| Body | The payload, normally JSON |
| Status code | 200 success, 400 bad input, 401 unauthenticated, 500 server fault |
Authentication in practice
Most APIs identify the caller with either an API key sent in a header or a bearer token such as a JWT. Tokens usually carry an expiry, so clients refresh them periodically. Never place credentials in a URL — they end up in logs, browser history and analytics.
JSON Formatter
Paste a raw response to format, fold and validate it instantly.
Characteristics
- A published, versioned contract independent of implementation
- Typically HTTP with JSON payloads on the web
- Status codes communicate outcome separately from the body
- Authentication via API keys or bearer tokens
Common uses
- Connecting a front-end application to its back end
- Integrating third-party services such as payments, email or maps
- Machine-to-machine automation and webhooks
- Exposing internal data to partner systems safely
Advantages
- Decouples teams — clients and servers evolve independently
- Reuses one back end across web, mobile and partner clients
- Standard status codes and formats make tooling interchangeable
- Enables automation without screen scraping
Limitations
- Breaking changes need versioning and a migration path
- Every network call adds latency and failure modes
- Rate limits and quotas constrain heavy clients
- Poorly documented contracts are as bad as none
Examples
POST /v1/users HTTP/1.1
Content-Type: application/json
Authorization: Bearer <token>
{ "name": "Ada Lovelace", "email": "ada@example.com" }
HTTP/1.1 201 Created
{ "id": 4821, "name": "Ada Lovelace" }Frequently asked questions
What is an API in simple terms?
A defined way for one program to ask another for data or to perform an action, without knowing how it is implemented.
What is a REST API?
An HTTP API organised around resources, where the method expresses the intent and the path identifies the resource.
Why do APIs use JSON?
It is compact, human-readable and maps directly onto native data structures in every common language.
What does a 401 status mean?
The request was not authenticated — the token is missing, expired or invalid.
What is the difference between REST and GraphQL?
REST exposes many endpoints returning fixed shapes; GraphQL exposes one endpoint where the client specifies the fields it needs.
Related terms
JSON
JSON is a lightweight text-based data format commonly used to exchange structured data between applications and APIs.
JSON Schema
JSON Schema is a declarative vocabulary, itself written in JSON, that describes the expected structure, types and constraints of a JSON document so it can be validated automatically.
JWT
A JSON Web Token (JWT) is a compact, signed token that carries JSON claims about a user or client so a server can verify identity without a database lookup.
Base64
Base64 is an encoding scheme that represents binary data using 64 printable ASCII characters so it can travel safely through text-only channels.
XML
XML (Extensible Markup Language) is a text format that describes data using nested, self-labelled tags, designed for documents and long-lived system-to-system messaging.
YAML
YAML is a whitespace-indented data format designed to be written and read by people, most often used for configuration files such as CI pipelines and Kubernetes manifests.
Related tools
Related guides
What Is JSON? A Plain-English Guide
JSON explained without jargon: what it is, how the syntax works, which data types it supports, where it is used and how it differs from JavaScript objects.
How to Format JSON (Beautify, Indent and Minify)
Learn how JSON formatting works, see a before-and-after example, fix the errors that block beautifying, and format JSON online in your browser without uploading a file.
How to Merge PDF Files Without Uploading Them
Combine several PDFs into one document: how merging works, how to control page order and orientation, what breaks bookmarks and forms, and how to do it without uploading files.
The Pomodoro Technique: A Practical Setup Guide
How the Pomodoro Technique works, choosing interval lengths, handling interruptions, tracking sessions honestly, and adapting the method to deep work and meetings.