{
  "openapi": "3.1.0",
  "info": {
    "title": "Dar Masar Marketing API",
    "version": "1.0.0",
    "description": "Read-only catalog of دار مسار للنشر والتوزيع (Kuwait) for marketing and content tools: books, authors, categories, offers and brand assets. Public data only — no customer, order or payment data. GET only; no authentication; 120 requests per minute per IP. Data is live from the store (cached up to 60 s)."
  },
  "servers": [
    {
      "url": "https://darmasar.com.kw/api/marketing"
    }
  ],
  "paths": {
    "/catalog": {
      "get": {
        "operationId": "getCatalog",
        "summary": "Everything in one response: brand, categories, authors, offers, new releases and a page of books",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000,
              "default": 1
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Catalog"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unknown parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found, or the marketing catalog is switched off",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests (limit: 120 per minute per IP)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/books": {
      "get": {
        "operationId": "listBooks",
        "summary": "Books, with search and filters",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000,
              "default": 1
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          },
          {
            "name": "q",
            "in": "query",
            "description": "Search in title, author and description (Arabic)",
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "name": "category",
            "in": "query",
            "description": "Category slug (see /categories)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "author",
            "in": "query",
            "description": "Author slug (see /authors)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "enum": [
                "available",
                "out_of_stock",
                "coming_soon",
                "preorder"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "books": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Book"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/Pagination"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unknown parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found, or the marketing catalog is switched off",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests (limit: 120 per minute per IP)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/books/{id}": {
      "get": {
        "operationId": "getBook",
        "summary": "One book with back cover, approved preview pages and related books",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Book id or slug",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "book": {
                      "$ref": "#/components/schemas/BookDetails"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unknown parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found, or the marketing catalog is switched off",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests (limit: 120 per minute per IP)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/new-releases": {
      "get": {
        "operationId": "listNewReleases",
        "summary": "Books marked as new releases, in the store's order",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 12
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "new_releases": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Book"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unknown parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found, or the marketing catalog is switched off",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests (limit: 120 per minute per IP)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/authors": {
      "get": {
        "operationId": "listAuthors",
        "summary": "Authors with at least one book in the catalog",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "authors": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Author"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unknown parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found, or the marketing catalog is switched off",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests (limit: 120 per minute per IP)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/categories": {
      "get": {
        "operationId": "listCategories",
        "summary": "Book categories",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "categories": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Category"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unknown parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found, or the marketing catalog is switched off",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests (limit: 120 per minute per IP)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/offers": {
      "get": {
        "operationId": "listOffers",
        "summary": "Current and upcoming offers: campaigns, book discounts, series bundles, public coupon codes and shipping",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "as_of": {
                      "type": "string",
                      "format": "date"
                    },
                    "offers": {
                      "$ref": "#/components/schemas/Offers"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unknown parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found, or the marketing catalog is switched off",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests (limit: 120 per minute per IP)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/brand": {
      "get": {
        "operationId": "getBrand",
        "summary": "Logos (PNG, transparent), colours, fonts and official social accounts",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "brand": {
                      "$ref": "#/components/schemas/Brand"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unknown parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found, or the marketing catalog is switched off",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests (limit: 120 per minute per IP)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/media/original/{file}": {
      "get": {
        "operationId": "getOriginalCover",
        "summary": "Untouched cover file (linked from Book.images when available)",
        "parameters": [
          {
            "name": "file",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Image",
            "content": {
              "image/*": {}
            }
          },
          "404": {
            "description": "Not found, or the marketing catalog is switched off",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/media/preview/{book}/{page}": {
      "get": {
        "operationId": "getPreviewPage",
        "summary": "A 'read the first pages' image of a book whose preview is approved for marketing",
        "parameters": [
          {
            "name": "book",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Image",
            "content": {
              "image/webp": {}
            }
          },
          "404": {
            "description": "Not found, or the marketing catalog is switched off",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        }
      },
      "Money": {
        "type": "object",
        "required": [
          "amount",
          "currency",
          "formatted"
        ],
        "properties": {
          "amount": {
            "type": "number",
            "example": 4.5
          },
          "currency": {
            "const": "KWD"
          },
          "formatted": {
            "type": "string",
            "example": "4.500 د.ك"
          }
        }
      },
      "Image": {
        "type": "object",
        "description": "An image with its real size. quality=original is the untouched file the store uploaded; web is the copy the website shows (the highest available when no original was kept).",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "quality": {
            "enum": [
              "original",
              "web"
            ]
          },
          "format": {
            "type": [
              "string",
              "null"
            ],
            "example": "webp"
          },
          "mime": {
            "type": [
              "string",
              "null"
            ],
            "example": "image/webp"
          },
          "width": {
            "type": [
              "integer",
              "null"
            ]
          },
          "height": {
            "type": [
              "integer",
              "null"
            ]
          },
          "bytes": {
            "type": [
              "integer",
              "null"
            ]
          },
          "has_transparency": {
            "type": "boolean"
          }
        }
      },
      "Pagination": {
        "type": "object",
        "properties": {
          "page": {
            "type": "integer"
          },
          "per_page": {
            "type": "integer"
          },
          "total": {
            "type": "integer"
          },
          "total_pages": {
            "type": "integer"
          },
          "next_page": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          }
        }
      },
      "Book": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "slug": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "author": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "integer"
              },
              "name": {
                "type": "string"
              },
              "url": {
                "type": "string",
                "format": "uri"
              }
            }
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "description": "Full description from the store"
          },
          "marketing_blurb": {
            "type": [
              "string",
              "null"
            ],
            "description": "Short marketing line written by the store; null when none was written"
          },
          "categories": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "integer"
                },
                "slug": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                }
              }
            }
          },
          "series": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "part": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "source": {
                "enum": [
                  "book",
                  "series_bundle"
                ]
              }
            }
          },
          "price": {
            "$ref": "#/components/schemas/Money"
          },
          "compare_at_price": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Money"
              },
              {
                "type": "null"
              }
            ],
            "description": "Price before a running discount"
          },
          "on_sale": {
            "type": "boolean"
          },
          "status": {
            "enum": [
              "available",
              "out_of_stock",
              "coming_soon",
              "preorder"
            ]
          },
          "status_ar": {
            "type": "string"
          },
          "preorder_ships_on": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "is_new": {
            "type": "boolean"
          },
          "isbn": {
            "type": [
              "string",
              "null"
            ]
          },
          "pages": {
            "type": [
              "integer",
              "null"
            ]
          },
          "release_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "Actual publication date; null when the store has not entered it"
          },
          "added_to_store_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "images": {
            "type": "object",
            "properties": {
              "front_cover": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/Image"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "back_cover": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/Image"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          "links": {
            "type": "object",
            "properties": {
              "product_page": {
                "type": "string",
                "format": "uri"
              },
              "buy": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      },
      "BookDetails": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Book"
          },
          {
            "type": "object",
            "properties": {
              "images": {
                "type": "object",
                "properties": {
                  "preview_pages": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/Image"
                    }
                  }
                }
              },
              "related_books": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "integer"
                    },
                    "title": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    },
                    "reason": {
                      "enum": [
                        "same_series",
                        "same_author",
                        "same_category"
                      ]
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "Author": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "bio": {
            "type": [
              "string",
              "null"
            ]
          },
          "photo": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Image"
              },
              {
                "type": "null"
              }
            ],
            "description": "Only when the store approved the photo for publishing"
          },
          "books_count": {
            "type": "integer"
          },
          "books": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "integer"
                },
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string",
                  "format": "uri"
                }
              }
            }
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "Category": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "tagline": {
            "type": [
              "string",
              "null"
            ]
          },
          "books_count": {
            "type": "integer"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "Offers": {
        "type": "object",
        "properties": {
          "campaigns": {
            "type": "array",
            "description": "Marketing campaigns such as 'buy 2, get the 3rd free'. applies_in_cart=false means prices in the store are not changed yet.",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "const": "buy_x_get_y"
                },
                "id": {
                  "type": "integer"
                },
                "name": {
                  "type": "string"
                },
                "buy_quantity": {
                  "type": "integer"
                },
                "free_quantity": {
                  "type": "integer"
                },
                "starts_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date"
                },
                "ends_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date"
                },
                "status": {
                  "enum": [
                    "scheduled",
                    "running"
                  ]
                },
                "publicly_announced": {
                  "type": "boolean"
                },
                "applies_in_cart": {
                  "type": "boolean"
                },
                "included": {
                  "type": "object"
                },
                "excluded_books": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "integer"
                      },
                      "title": {
                        "type": "string"
                      },
                      "url": {
                        "type": "string",
                        "format": "uri"
                      }
                    }
                  }
                },
                "terms": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "marketing_text": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "landing_page": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uri"
                }
              }
            }
          },
          "book_discounts": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "series_bundles": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "coupon_codes": {
            "type": "array",
            "description": "Only codes the store marked as allowed for marketing",
            "items": {
              "type": "object"
            }
          },
          "shipping": {
            "type": "object",
            "properties": {
              "kuwait_fee": {
                "$ref": "#/components/schemas/Money"
              },
              "free_shipping_over": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/Money"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "free_shipping_outside_kuwait": {
                "type": "boolean"
              }
            }
          }
        }
      },
      "Brand": {
        "type": "object",
        "properties": {
          "name": {
            "type": "object"
          },
          "website": {
            "type": "string"
          },
          "logos": {
            "type": "array",
            "items": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Image"
                },
                {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    }
                  }
                }
              ]
            }
          },
          "svg_logo": {
            "type": "null"
          },
          "colors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "hex": {
                  "type": "string"
                },
                "role": {
                  "type": "string"
                }
              }
            }
          },
          "fonts": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "social": {
            "type": "object"
          }
        }
      },
      "Catalog": {
        "type": "object",
        "properties": {
          "brand": {
            "$ref": "#/components/schemas/Brand"
          },
          "categories": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Category"
            }
          },
          "authors": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Author"
            }
          },
          "offers": {
            "$ref": "#/components/schemas/Offers"
          },
          "new_releases": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "integer"
                },
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string",
                  "format": "uri"
                }
              }
            }
          },
          "books": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Book"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/Pagination"
          }
        }
      }
    }
  }
}