# Redocly Cafe

Demo API for cafe operators (not customers) to manage menus, orders, and revenue.
Create API credentials and try it yourself in a realistic OpenAPI workflow.


Version: 1.1.0
License: MIT

## Servers

Live server.
```
https://api.cafe.redocly.com
```

## Security

### OAuth2

OAuth2 authorization for API access. The token endpoint accepts `grant_type=authorization_code`, `grant_type=client_credentials`, and `grant_type=refresh_token`.
Standard OAuth2 client libraries can drive these flows unmodified.
Server capabilities are discoverable from the [RFC 8414 metadata endpoint](https://api.cafe.redocly.com/.well-known/oauth-authorization-server).
### Protocol behavior
- **Errors follow RFC 6749 Section 5.2 and RFC 7591 Section 3.2.2.**
 The OAuth2 endpoints return
`{"error": ..., "error_description": ...}`
 with the standard codes (
`invalid_grant`
,
`invalid_client`
,
`unsupported_grant_type`
,
`invalid_scope`
,
`invalid_client_metadata`
, ...). The rest of the API uses RFC 9457 problem+json.
- **Client authentication.**
 Both
`client_secret_basic`
 (HTTP Basic per RFC 6749 Section 2.3.1) and
`client_secret_post`
 (credentials in the form body) are accepted at the token and revocation endpoints, but not both in one request.
- **PKCE (RFC 7636) is supported**
 for the authorization code flow with the
`S256`
 and
`plain`
 challenge methods (
`S256`
 recommended). When an authorization request carries a
`code_challenge`
, the token exchange requires the matching
`code_verifier`
.
- **Refresh tokens rotate on every use.**
 A successful refresh retires the token presented and returns a replacement in
`refresh_token`
, as RFC 6749 Section 6 permits and RFC 9700 recommends. Store the new value; the old one stops working. Refresh tokens expire 30 days after they are issued, and rotation restarts that window. The authorization code flow returns a refresh token only when the client is registered for the
`refresh_token`
 grant type; the client credentials flow returns none (RFC 6749 Section 4.4.3).
- **Authorization responses carry `iss`**
 (RFC 9207) alongside
`code`
 and
`state`
.
- **Tokens can be revoked**
 at the
[revocation endpoint](https://api.cafe.redocly.com/oauth2/revoke)
 (RFC 7009), and client registrations managed via RFC 7592 using the
`registration_access_token`
.
- **`scope` accepts commas.**
 The space-delimited form required by RFC 6749 is always accepted and recommended; comma-separated values are additionally tolerated.

Type: oauth2
Token URL: https://api.cafe.redocly.com/oauth2/token
Scopes:
- `menu:read`: Read access to menu items and images
- `menu:write`: Write access to menu items (create, delete)
- `orders:read`: Read access to orders
- `orders:write`: Write access to orders (create, update, delete)
- `revenue:read`: Read access to revenue statistics

### ApiKey

API key for internal operations.

Type: apiKey
In: header
Name: X-API-Key

### RegistrationAccessToken

Registration access token from the client registration response (RFC 7592), sent as a Bearer token to authenticate requests to the client configuration endpoint (`/oauth2/register/{clientId}`).

Type: http
Scheme: bearer

## Download OpenAPI description

 - [Redocly Cafe](https://thinkproject-d03nr-docs-k9qml.redocly.app/_bundle/openapi.yaml)

## Authorization

 - [POST /oauth2/register](https://thinkproject-d03nr-docs-k9qml.redocly.app/openapi/authorization/registeroauth2client.md): Register a new OAuth2 client, implementing the Dynamic Client Registration Protocol (RFC 7591) with the standard snake_case metadata names, so off-the-shelf DCR clients work without modification. Resp
 - [GET /oauth2/register/{clientId}](https://thinkproject-d03nr-docs-k9qml.redocly.app/openapi/authorization/getoauth2client.md): Read the current registration of an OAuth2 client (RFC 7592 Section 2.1). Authenticate with the `registration_access_token` returned at registration, as a Bearer token in the `Authorization` header. A
 - [PUT /oauth2/register/{clientId}](https://thinkproject-d03nr-docs-k9qml.redocly.app/openapi/authorization/updateoauth2client.md): Replace the registration metadata of an OAuth2 client (RFC 7592 Section 2.2). Authenticate with the `registration_access_token` as a Bearer token. This is a full replacement, not a merge: omitted meta
 - [DELETE /oauth2/register/{clientId}](https://thinkproject-d03nr-docs-k9qml.redocly.app/openapi/authorization/deleteoauth2client.md): Deprovision an OAuth2 client (RFC 7592 Section 2.3). Authenticate with the `registration_access_token` as a Bearer token. Deleting a client also invalidates all of its tokens and pending authorization
 - [POST /oauth2/token](https://thinkproject-d03nr-docs-k9qml.redocly.app/openapi/authorization/createaccesstoken.md): OAuth2 token endpoint (RFC 6749 Section 3.2). Supports the `authorization_code`, `client_credentials`, and `refresh_token` grant types. **Client authentication.** Authenticate with HTTP Basic (`Author
 - [POST /oauth2/revoke](https://thinkproject-d03nr-docs-k9qml.redocly.app/openapi/authorization/revoketoken.md): OAuth2 token revocation endpoint (RFC 7009). Revokes an access or refresh token issued to the authenticated client. Access and refresh tokens issued together are revoked together. Authenticate with HT
 - [GET /.well-known/oauth-authorization-server](https://thinkproject-d03nr-docs-k9qml.redocly.app/openapi/authorization/getauthorizationservermetadata.md): OAuth2 authorization server metadata (RFC 8414). Lists the authorization, token, registration, and revocation endpoints along with the supported scopes, grant types, client authentication methods, and
## Products

 - [GET /menu](https://thinkproject-d03nr-docs-k9qml.redocly.app/openapi/products/listmenuitems.md): Retrieve a collection of menu items with optional filtering and pagination.
 - [POST /menu](https://thinkproject-d03nr-docs-k9qml.redocly.app/openapi/products/createmenuitem.md): Create a new menu item.
 - [DELETE /menu/{menuItemId}](https://thinkproject-d03nr-docs-k9qml.redocly.app/openapi/products/deletemenuitem.md): Delete an existing menu item.
 - [GET /menu-item-images/{menuItemId}](https://thinkproject-d03nr-docs-k9qml.redocly.app/openapi/products/getmenuitemphoto.md): Retrieve the product photo image for a specific menu item.
## Orders

 - [GET /orders](https://thinkproject-d03nr-docs-k9qml.redocly.app/openapi/orders/listorders.md): Retrieve a collection of orders with optional filtering and pagination.
 - [POST /orders](https://thinkproject-d03nr-docs-k9qml.redocly.app/openapi/orders/createorder.md): Create a new order. Order items cannot be changed - if they need to be updated, cancel the order and place a new one.
 - [GET /orders/{orderId}](https://thinkproject-d03nr-docs-k9qml.redocly.app/openapi/orders/getorderbyid.md): Retrieve a single order by its ID.
 - [PATCH /orders/{orderId}](https://thinkproject-d03nr-docs-k9qml.redocly.app/openapi/orders/updateorder.md): Update an existing order status. Order items cannot be changed - if they need to be updated, cancel the order and place a new one.
 - [DELETE /orders/{orderId}](https://thinkproject-d03nr-docs-k9qml.redocly.app/openapi/orders/deleteorder.md): Delete the order. To keep the order history, cancel the order instead of deleting it.
 - [GET /order-items](https://thinkproject-d03nr-docs-k9qml.redocly.app/openapi/orders/listorderitems.md): Returns an array of order items for a specific order. Use the `filter` parameter to filter by order ID.
 - [POST order-notification](https://thinkproject-d03nr-docs-k9qml.redocly.app/openapi/orders/ordernotificationwebhook.md): Webhook triggered when a new order is placed.
## Statistics

 - [GET /revenue](https://thinkproject-d03nr-docs-k9qml.redocly.app/openapi/statistics/getrevenue.md): Retrieve revenue statistics for a configurable date range. Returns revenue, order counts, average order amount, and other useful statistics.
