---
title: What are API Responses and JSON?
description: Learn what an API response contains, how JSON structures data as key-value pairs and how to read an example response from the OpusDNS API.
---

[Skip to content](https://help.opusdns.com/what-are-api-responses-and-json#main-content)

- [English](https://help.opusdns.com/what-are-api-responses-and-json)
- [Deutsch](https://help.opusdns.com/de/was-ist-eine-api-response-und-json)

English

Show submenu for translations

[![opusdns.com](https://help.opusdns.com/hs-fs/hubfs/v2-Status%20Center.png?width=180&height=51&name=v2-Status%20Center.png)](https://help.opusdns.com/?hsLang=en)

Open main navigation

Close main navigation

- - [English](https://help.opusdns.com/what-are-api-responses-and-json)
    - [Deutsch](https://help.opusdns.com/de/was-ist-eine-api-response-und-json)

  English
  
  Show submenu for translations
- [Submit Ticket](https://support.opusdns.com/)

[Submit Ticket](https://support.opusdns.com/?hsLang=en)

 How can we help?

- There are no suggestions because the search field is empty.

1. [OpusDNS Knowledgebase](https://help.opusdns.com/?hsLang=en)
2. [New to the Domain Industry?](https://help.opusdns.com/new-to-the-domain-industry?hsLang=en)
3. [Reseller Essentials](https://help.opusdns.com/new-to-the-domain-industry?hsLang=en#reseller-essentials)

November 16, 2026

# What are API Responses and JSON?

## Status codes, response data and the JSON format explained with examples

When a client sends a request to an API, the API processes it and sends back a response. The response tells the client whether the request worked and contains the requested data or an error message. Most web APIs, including the OpusDNS API, use JSON (JavaScript Object Notation) for this: a lightweight text format that is easy for people to read and for programs to process.

 

### Parts of an API response

 

#### Status code

The HTTP status code tells the client whether the request was successful. Status codes are grouped by their first digit:

- **2xx (success):** The request was processed, for example `200 OK` or `201 Created`.
- **3xx (redirection):** The resource is somewhere else, for example `301 Moved Permanently`.
- **4xx (client errors):** Something is wrong with the request, for example `400 Bad Request`, `401 Unauthorized` (missing or invalid credentials) or `404 Not Found`.
- **5xx (server errors):** A problem on the server side, for example `500 Internal Server Error`.

 

#### Data

The body of the response contains the data, for example a list of domains, the details of a contact or a description of an error. It is usually structured as JSON.

 

### What is JSON?

JSON describes data as key-value pairs. Each key is a string in double quotes. A value can be:

- a string, for example `"example.com"`,
- a number, for example `10`,
- a boolean, `true` or `false`,
- `null` for "no value",
- an object (more key-value pairs in curly braces),
- an array (a list in square brackets).

A simple example:

```
{
  "name": "example.com",
  "available": true,
  "price": null,
  "nameservers": ["ns1.example.net", "ns2.example.net"],
  "contact": {
    "name": "Jane Example",
    "email": "jane@example.com"
  }
}
```

Here `"name"` is a key with the string value `"example.com"`, `"nameservers"` holds an array and `"contact"` holds another object.

 

### Why JSON is used in APIs

- **Readable:** Developers can read and understand responses easily.
- **Lightweight:** JSON is more compact than formats such as XML, which speeds up transmission.
- **Language-independent:** Practically every programming language can read and write JSON.

 

### Example: a response from the OpusDNS API

This request lists the domains of an account in the sandbox, ten per page:

```
curl "https://sandbox.opusdns.com/v1/domains?page=1&page_size=10" \
  --header "X-Api-Key: YOUR_API_KEY"
```

For an account without domains, the API answers with status `200 OK` and this JSON:

```
{
  "items": [],
  "total": 0,
  "page": 1,
  "page_size": 10
}
```

- `items`: the domains on this page, here an empty array,
- `total`: the total number of domains,
- `page` and `page_size`: the current page and the number of entries per page.

The fields of each endpoint are described in the API reference on [developers.opusdns.com](https://developers.opusdns.com). If a request fails, check the status code first. Help with errors: [What can I do if I encounter errors with the OpusDNS API?](https://help.opusdns.com/what-can-i-do-if-i-encounter-errors-with-the-opusdns-api?hsLang=en) Your past requests and their responses are listed in the dashboard under **Developer \> Request History**, see [Reading API Request History](https://help.opusdns.com/api-request-history?hsLang=en).

- [Create your OpusDNS account](https://help.opusdns.com/create-your-opusdns-account?hsLang=en#main-content)

    - [Open Your Account](https://help.opusdns.com/create-your-opusdns-account?hsLang=en#open-your-account)
    - [FAQ](https://help.opusdns.com/create-your-opusdns-account?hsLang=en#faq)
    - [Getting Help with your Registration](https://help.opusdns.com/create-your-opusdns-account?hsLang=en#getting-help-with-your-registration)
- [OpusDNS API](https://help.opusdns.com/opusdns-api?hsLang=en#main-content)

    - [Getting Started with the API](https://help.opusdns.com/opusdns-api?hsLang=en#getting-started-with-the-api)
    - [Sandbox Environment](https://help.opusdns.com/opusdns-api?hsLang=en#sandbox-environment)
    - [OpusDNS MCP Server](https://help.opusdns.com/opusdns-api?hsLang=en#opusdns-mcp-server)
    - [FAQ](https://help.opusdns.com/opusdns-api?hsLang=en#faq)
    - [Getting Help with the OpusDNS API](https://help.opusdns.com/opusdns-api?hsLang=en#getting-help-with-the-opusdns-api)
- [OpusDNS Dashboard](https://help.opusdns.com/opusdns-dashboard?hsLang=en#main-content)

    - [Getting Started](https://help.opusdns.com/opusdns-dashboard?hsLang=en#getting-started)
    - [Plans & Pricing](https://help.opusdns.com/opusdns-dashboard?hsLang=en#plans-pricing)
    - [Billing & Payments](https://help.opusdns.com/opusdns-dashboard?hsLang=en#billing-payments)
    - [User & Organization Management](https://help.opusdns.com/opusdns-dashboard?hsLang=en#user-organization-management)
    - [Whitelabeling](https://help.opusdns.com/opusdns-dashboard?hsLang=en#whitelabeling)
    - [Account & Settings](https://help.opusdns.com/opusdns-dashboard?hsLang=en#account-settings)
    - [Security](https://help.opusdns.com/opusdns-dashboard?hsLang=en#security)
    - [AI Concierge](https://help.opusdns.com/opusdns-dashboard?hsLang=en#ai-concierge)
    - [Managing Contacts](https://help.opusdns.com/opusdns-dashboard?hsLang=en#managing-contacts)
    - [Managing DNS Zones & Nameservers](https://help.opusdns.com/opusdns-dashboard?hsLang=en#managing-dns-zones-nameservers)
    - [Register & Transfer Domains](https://help.opusdns.com/opusdns-dashboard?hsLang=en#register-transfer-domains)
    - [Managing Domains](https://help.opusdns.com/opusdns-dashboard?hsLang=en#managing-domains)
    - [Bulk Jobs](https://help.opusdns.com/opusdns-dashboard?hsLang=en#bulk-jobs)
    - [Developer Area](https://help.opusdns.com/opusdns-dashboard?hsLang=en#developer-area)
    - [Dashboard Functionality](https://help.opusdns.com/opusdns-dashboard?hsLang=en#dashboard-functionality)
    - [Dashboard home page](https://help.opusdns.com/opusdns-dashboard?hsLang=en#dashboard-home-page)
- [Services & Features](https://help.opusdns.com/services-features?hsLang=en#main-content)

    - [Domain forwarding](https://help.opusdns.com/services-features?hsLang=en#domain-forwarding)
    - [Email forwarding](https://help.opusdns.com/services-features?hsLang=en#email-forwarding)
    - [Reports](https://help.opusdns.com/services-features?hsLang=en#reports)
    - [Domain parking](https://help.opusdns.com/services-features?hsLang=en#domain-parking)
    - [WHMCS Integration](https://help.opusdns.com/services-features?hsLang=en#whmcs-integration)
    - [Hostware Integration](https://help.opusdns.com/services-features?hsLang=en#hostware-integration)
    - [Terraform Integration](https://help.opusdns.com/services-features?hsLang=en#terraform-integration)
    - [GO Integration](https://help.opusdns.com/services-features?hsLang=en#go-integration)
    - [Certificate Management with ACME and OpusDNS](https://help.opusdns.com/services-features?hsLang=en#certificate-management-with-acme-and-opusdns)
- [New to the Domain Industry?](https://help.opusdns.com/new-to-the-domain-industry?hsLang=en#main-content)

    - [Everything about Domains](https://help.opusdns.com/new-to-the-domain-industry?hsLang=en#everything-about-domains)
    - [Domain Industry](https://help.opusdns.com/new-to-the-domain-industry?hsLang=en#domain-industry)
    - [Reseller Essentials](https://help.opusdns.com/new-to-the-domain-industry?hsLang=en#reseller-essentials)

- [OpusDNS Homepage](https://www.opusdns.com/)
- [Legal Notice](https://www.opusdns.com/legal/notice-impressum)
- [Privacy Policy](https://www.opusdns.com/legal/privacy-policy)
- [Terms & Conditions](https://www.opusdns.com/legal/terms-conditions)

[![OpusDNS Homepage](https://help.opusdns.com/hubfs/6722ae7333e645c8919a4751_opusDNS-VT-3c-white-tagline.svg "OpusDNS Homepage")](https://www.opusdns.com/)

©2025 OpusDNS GmbH. All rights reserved.

<https://www.linkedin.com/company/opusdns/>

![icann](https://help.opusdns.com/hubfs/icann.svg).