# Responses

The **Mews POS API** follows the [JSON:API specification](https://jsonapi.org/) for formatting HTTP responses. `Content-Type` is set to the JSON:API media type `application/vnd.api+json`.

A typical JSON response looks like this:

```json
{
  "data": {
    "type": "invoices",
    "id": "12345",
    "attributes": {
      "customer_uuid": "customer-uuid",
      "order_uuid": "order-uuid",
      "register_uuid": "register-uuid",
      "total_amount": "100.00",
      "created_at": "2024-07-19T12:34:56Z",
      "updated_at": "2024-07-19T12:34:56Z"
    },
    "relationships": {
      "customer": {
        "links": {
          "self": "/api/v1/invoices/12345/relationships/customer",
          "related": "/api/v1/customers/customer-uuid"
        },
        "data": {
          "type": "customers",
          "id": "customer-uuid"
        }
      },
      "order": {
        "links": {
          "self": "/api/v1/invoices/12345/relationships/order",
          "related": "/api/v1/orders/order-uuid"
        },
        "data": {
          "type": "orders",
          "id": "order-uuid"
        }
      },
      "payments": {
        "links": {
          "self": "/api/v1/invoices/12345/relationships/payments",
          "related": "/api/v1/invoices/12345/payments"
        },
        "data": [
          {
            "type": "payments",
            "id": "payment-uuid-1"
          },
          {
            "type": "payments",
            "id": "payment-uuid-2"
          }
        ]
      }
    },
    "links": {
      "self": "/api/v1/invoices/12345"
    }
  },
  "headers": {
    "Content-Type": "application/vnd.api+json",
    "Cache-Control": "no-cache, no-store, must-revalidate",
    "Expires": "0",
    "X-RateLimit-Limit": "1000",
    "X-Response-Time": "123ms"
  }
}
```

## Response codes

| Code  | Meaning                                                                                                                                                                                          |
| ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `200` | <p><strong>OK</strong><br>Indicates that the request has succeeded.</p>                                                                                                                          |
| `201` | <p><strong>Created</strong><br>Indicates that the request has succeeded and a new resource has been created as a result.</p>                                                                     |
| `202` | <p><strong>Accepted</strong><br>Indicates that the request has received but not completed yet.</p>                                                                                               |
| `204` | <p><strong>No Content</strong><br>The server has fulfilled the request but does not need to return a response body.</p>                                                                          |
| `400` | <p><strong>Bad Request</strong><br>The request could not be understood by the server due to incorrect syntax. The client should not repeat the request without modifications.</p>                |
| `401` | <p><strong>Unauthorized</strong><br>Indicates that the request requires user authentication information.</p>                                                                                     |
| `403` | <p><strong>Forbidden</strong><br>Unauthorized request. The client does not have access rights to the content. Unlike 401, the client’s identity is known to the server.</p>                      |
| `404` | <p><strong>Not Found</strong><br>The server cannot find the requested resource.</p>                                                                                                              |
| `408` | <p><strong>Request Timeout</strong><br>Indicates that the server did not receive a complete request from the client within the server’s allotted timeout period.</p>                             |
| `409` | <p><strong>Conflict</strong><br>The request could not be completed due to a conflict with the current state of the resource.</p>                                                                 |
| `422` | <p><strong>Unprocessable Entity</strong><br>The server understands the content type and syntax of the request entity, but still the server is unable to process the request for some reason.</p> |
| `429` | <p><strong>Too Many Requests</strong><br>The user has sent too many requests in a given amount of time (“rate limiting”).</p>                                                                    |
| `500` | <p><strong>Internal Server Error</strong><br>The server encountered an unexpected condition that prevented it from fulfilling the request.</p>                                                   |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mews.com/pos-api/guidelines/responses.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
