> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sibipro.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Making a REST Request

> How to call the SIBI REST APIs

The SIBI public REST API exposes resources for Offers, Products, and Order Cancellation. You can use any HTTP client to make requests. The examples below use [curl](https://curl.se/) & [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch).

## Endpoint

The REST API is available at: [https://api.sibipro.com](https://api.sibipro.com)

Resources are exposed under the following base paths:

* `/offers` — manage offers (see the [Offers](/rest/offers) reference)
* `/products` — look up product details (see the [Products](/rest/products) reference)
* `/orders` — request order cancellation (see the [Order Cancellation](/rest/order-cancellation) reference)

## Authentication

The SIBI public API uses API keys to authenticate requests. You can create an API key in the [SIBI developer dashboard](https://developer.sibipro.com). The API expects the key to be included in all requests in the `Authorization` header, prefixed by `Bearer`.

```shell Curl theme={null}
curl \
  --request GET \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  https://api.sibipro.com/offers
# => {"data": [...]}
```

```javascript Fetch theme={null}
const response = await fetch('https://api.sibipro.com/offers', {
  method: 'GET',
  headers: { Authorization: `Bearer ${yourApiKey}` },
});
const offers = await response.json();
console.log(JSON.stringify(offers, null, 2));
```

## Making a Request

REST endpoints follow standard HTTP conventions. Use `GET` to read a resource and `POST` to create or trigger an action. Request bodies are sent as JSON with `Content-Type: application/json`.

### Reading a resource

```shell Curl theme={null}
curl \
  --request GET \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  https://api.sibipro.com/products/<SKU>
```

```javascript Fetch theme={null}
const response = await fetch(`https://api.sibipro.com/products/${sku}`, {
  method: 'GET',
  headers: { Authorization: `Bearer ${yourApiKey}` },
});
const product = await response.json();
```

### Sending data

```shell Curl theme={null}
curl \
  --request POST \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  --header 'Content-Type: application/json' \
  --data '{"reason": "Customer requested a cancellation"}' \
  https://api.sibipro.com/orders/<ORDER_ID>/cancel
```

```javascript Fetch theme={null}
const response = await fetch(`https://api.sibipro.com/orders/${orderId}/cancel`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${yourApiKey}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ reason: 'Customer requested a cancellation' }),
});
const result = await response.json();
```

## Responses

Successful responses return JSON. For example, a cancellation request returns:

```json Response theme={null}
{
  "cancellationStatus": "pending",
  "cancellationReason": "Customer requested a cancellation",
  "requestedAt": "2024-01-20T12:00:00Z"
}
```

## Errors

Errors are returned with a standard HTTP status code (`4xx` for client errors, `5xx` for server errors) and a JSON body describing the failure:

```json Error theme={null}
{
  "code": "VALIDATION_ERROR",
  "message": "Invalid input parameters",
  "details": [{ "field": "reason", "error": "Required" }]
}
```

For full schema details and the complete list of endpoints, see the per-resource references in the navigation.
