Response Formats

All APIVerve APIs support multiple response formats: JSON (default), XML, and YAML. You can specify the format using the Accept header.

Format Selection

Set the Accept header to application/json, application/xml, or application/yaml to specify the desired response format.

JSON Format (Default)

The default JSON format follows a consistent structure:

Success Response
200 OK
{
  "status": "success",
  "error": null,
  "data": {
    // Endpoint-specific data
  }
}
Error Response
400 Bad Request
{
  "status": "error",
  "error": "Description of what went wrong",
  "data": null
}

XML Format

Request XML format by setting the Accept: application/xml header:

XML Success Response
200 OK
<?xml version="1.0" encoding="UTF-8"?>
<response>
  <status>success</status>
  <error></error>
  <data>
    <!-- Endpoint-specific data -->
  </data>
</response>
XML Error Response
400 Bad Request
<?xml version="1.0" encoding="UTF-8"?>
<response>
  <status>error</status>
  <error>Description of what went wrong</error>
  <data></data>
</response>

YAML Format

Request YAML format by setting the Accept: application/yaml header:

YAML Success Response
200 OK
status: success
error: null
data:
  # Endpoint-specific data
YAML Error Response
400 Bad Request
status: error
error: "Description of what went wrong"
data: null

For detailed information about error codes, common error scenarios, and best practices for handling errors in your application, see our error handling guide.

What's Next?

Continue your journey with these recommended resources

Was this page helpful?