OptimoCMSDocs

Ecommerce

Products, orders, and coupons

GET
/v1/sites/{siteId}/shop/products

Authorization

ApiKeyAuth
X-Api-Key<token>

API key obtained from the CMS dashboard.

In: header

Path Parameters

siteId*string

Query Parameters

limit?integer
Default25
Rangevalue <= 100
cursor?string
active?string
Value in"true" | "false"
category?string

Response Body

application/json

application/json

curl -X GET "https://example.com/v1/sites/string/shop/products"
{
  "data": [
    {
      "id": "string",
      "title": "string",
      "price": 0,
      "currency": "EUR",
      "description": "string",
      "images": [
        "string"
      ],
      "category": "string",
      "stock": 0,
      "active": true,
      "type": "physical",
      "variants": [
        {}
      ],
      "createdAt": "2019-08-24T14:15:22Z"
    }
  ],
  "meta": {
    "requestId": "d385ab22-0f51-4b97-9ecd-b8ff3fd4fcb6",
    "timestamp": "2019-08-24T14:15:22Z"
  },
  "pagination": {
    "total": 0,
    "limit": 0,
    "nextCursor": "string"
  }
}
{
  "error": {
    "code": "string",
    "message": "string",
    "details": {}
  },
  "meta": {
    "requestId": "d385ab22-0f51-4b97-9ecd-b8ff3fd4fcb6",
    "timestamp": "2019-08-24T14:15:22Z"
  }
}
POST
/v1/sites/{siteId}/shop/products

Authorization

ApiKeyAuth
X-Api-Key<token>

API key obtained from the CMS dashboard.

In: header

Path Parameters

siteId*string

Header Parameters

Idempotency-Key*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X POST "https://example.com/v1/sites/string/shop/products" \  -H "Idempotency-Key: string" \  -H "Content-Type: application/json" \  -d '{    "title": "string",    "price": 0  }'
{
  "data": {
    "id": "string",
    "title": "string",
    "price": 0,
    "currency": "EUR",
    "description": "string",
    "images": [
      "string"
    ],
    "category": "string",
    "stock": 0,
    "active": true,
    "type": "physical",
    "variants": [
      {}
    ],
    "createdAt": "2019-08-24T14:15:22Z"
  },
  "meta": {
    "requestId": "d385ab22-0f51-4b97-9ecd-b8ff3fd4fcb6",
    "timestamp": "2019-08-24T14:15:22Z"
  }
}
{
  "error": {
    "code": "string",
    "message": "string",
    "details": {}
  },
  "meta": {
    "requestId": "d385ab22-0f51-4b97-9ecd-b8ff3fd4fcb6",
    "timestamp": "2019-08-24T14:15:22Z"
  }
}
{
  "error": {
    "code": "string",
    "message": "string",
    "details": {}
  },
  "meta": {
    "requestId": "d385ab22-0f51-4b97-9ecd-b8ff3fd4fcb6",
    "timestamp": "2019-08-24T14:15:22Z"
  }
}
PUT
/v1/sites/{siteId}/shop/products/{productId}

Authorization

ApiKeyAuth
X-Api-Key<token>

API key obtained from the CMS dashboard.

In: header

Path Parameters

siteId*string
productId*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X PUT "https://example.com/v1/sites/string/shop/products/string" \  -H "Content-Type: application/json" \  -d '{    "title": "string",    "price": 0  }'
{
  "data": {
    "id": "string",
    "title": "string",
    "price": 0,
    "currency": "EUR",
    "description": "string",
    "images": [
      "string"
    ],
    "category": "string",
    "stock": 0,
    "active": true,
    "type": "physical",
    "variants": [
      {}
    ],
    "createdAt": "2019-08-24T14:15:22Z"
  },
  "meta": {
    "requestId": "d385ab22-0f51-4b97-9ecd-b8ff3fd4fcb6",
    "timestamp": "2019-08-24T14:15:22Z"
  }
}
{
  "error": {
    "code": "string",
    "message": "string",
    "details": {}
  },
  "meta": {
    "requestId": "d385ab22-0f51-4b97-9ecd-b8ff3fd4fcb6",
    "timestamp": "2019-08-24T14:15:22Z"
  }
}
{
  "error": {
    "code": "string",
    "message": "string",
    "details": {}
  },
  "meta": {
    "requestId": "d385ab22-0f51-4b97-9ecd-b8ff3fd4fcb6",
    "timestamp": "2019-08-24T14:15:22Z"
  }
}
GET
/v1/sites/{siteId}/shop/orders

Authorization

ApiKeyAuth
X-Api-Key<token>

API key obtained from the CMS dashboard.

In: header

Path Parameters

siteId*string

Query Parameters

limit?integer
Default25
Rangevalue <= 100
cursor?string
status?string
Value in"pending" | "paid" | "shipped" | "delivered" | "completed" | "cancelled" | "refunded"
orderBy?string
Default"createdAt"
Value in"createdAt" | "total" | "status"
direction?string
Default"desc"
Value in"asc" | "desc"

Response Body

application/json

application/json

curl -X GET "https://example.com/v1/sites/string/shop/orders"
{
  "data": [
    {
      "id": "string",
      "status": "pending",
      "total": 0,
      "currency": "string",
      "customer": {},
      "itemCount": 0,
      "shipping": {},
      "trackingNumber": "string",
      "createdAt": "2019-08-24T14:15:22Z"
    }
  ],
  "meta": {
    "requestId": "d385ab22-0f51-4b97-9ecd-b8ff3fd4fcb6",
    "timestamp": "2019-08-24T14:15:22Z"
  },
  "pagination": {
    "total": 0,
    "limit": 0,
    "nextCursor": "string"
  }
}
{
  "error": {
    "code": "string",
    "message": "string",
    "details": {}
  },
  "meta": {
    "requestId": "d385ab22-0f51-4b97-9ecd-b8ff3fd4fcb6",
    "timestamp": "2019-08-24T14:15:22Z"
  }
}
GET
/v1/sites/{siteId}/shop/coupons

Authorization

ApiKeyAuth
X-Api-Key<token>

API key obtained from the CMS dashboard.

In: header

Path Parameters

siteId*string

Response Body

application/json

application/json

curl -X GET "https://example.com/v1/sites/string/shop/coupons"
{
  "data": [
    {
      "id": "string",
      "code": "string",
      "type": "percent",
      "amount": 0,
      "active": true
    }
  ],
  "meta": {
    "requestId": "d385ab22-0f51-4b97-9ecd-b8ff3fd4fcb6",
    "timestamp": "2019-08-24T14:15:22Z"
  }
}
{
  "error": {
    "code": "string",
    "message": "string",
    "details": {}
  },
  "meta": {
    "requestId": "d385ab22-0f51-4b97-9ecd-b8ff3fd4fcb6",
    "timestamp": "2019-08-24T14:15:22Z"
  }
}
POST
/v1/sites/{siteId}/shop/coupons

Authorization

ApiKeyAuth
X-Api-Key<token>

API key obtained from the CMS dashboard.

In: header

Path Parameters

siteId*string

Header Parameters

Idempotency-Key*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X POST "https://example.com/v1/sites/string/shop/coupons" \  -H "Idempotency-Key: string" \  -H "Content-Type: application/json" \  -d '{    "code": "string",    "type": "percent",    "amount": 1  }'
{
  "data": {
    "id": "string",
    "code": "string",
    "type": "percent",
    "amount": 0,
    "active": true
  },
  "meta": {
    "requestId": "d385ab22-0f51-4b97-9ecd-b8ff3fd4fcb6",
    "timestamp": "2019-08-24T14:15:22Z"
  }
}
{
  "error": {
    "code": "string",
    "message": "string",
    "details": {}
  },
  "meta": {
    "requestId": "d385ab22-0f51-4b97-9ecd-b8ff3fd4fcb6",
    "timestamp": "2019-08-24T14:15:22Z"
  }
}
{
  "error": {
    "code": "string",
    "message": "string",
    "details": {}
  },
  "meta": {
    "requestId": "d385ab22-0f51-4b97-9ecd-b8ff3fd4fcb6",
    "timestamp": "2019-08-24T14:15:22Z"
  }
}
POST
/v1/sites/{siteId}/shop/coupons/{couponId}/deactivate

Authorization

ApiKeyAuth
X-Api-Key<token>

API key obtained from the CMS dashboard.

In: header

Path Parameters

siteId*string
couponId*string

Response Body

application/json

application/json

curl -X POST "https://example.com/v1/sites/string/shop/coupons/string/deactivate"
{
  "data": {
    "id": "string",
    "active": false
  },
  "meta": {
    "requestId": "d385ab22-0f51-4b97-9ecd-b8ff3fd4fcb6",
    "timestamp": "2019-08-24T14:15:22Z"
  }
}
{
  "error": {
    "code": "string",
    "message": "string",
    "details": {}
  },
  "meta": {
    "requestId": "d385ab22-0f51-4b97-9ecd-b8ff3fd4fcb6",
    "timestamp": "2019-08-24T14:15:22Z"
  }
}