swagger: '2.0'
info:
  description: >-

    Welcome to the Prisync API (proudly version 2.0) documentation.


    Prisync API is a RESTful API which enables programmatically controlling
    actions on your Prisync account.

    **For example**: You can simply integrate your competitor prices from
    Prisync into your e-commerce software, such as Magento, Opencart or CSCart.

    ---

    You can instantly sign up on [prisync.com](https://prisync.com) and get
    your API credentials.


    The Prisync API is an application programming interface allowing you to
    access:
      * your products,
      * competitor prices,
      * competitor URLs,
      * *SmartPrice*s (See <a
        href="https://prisync.com/dynamic-pricing-software/">
        our page explaining Dynamic Pricing Engine and SmartPrice</a>)
      * and all the other resources within the Prisync cloud with simple,
        beautiful and easy-to-understand programmatic way via friendly HTTP
        requests.

    We worked hard to get most intuitive and most powerful endpoints,
    to allow you get the data easily or do whatever actions you want.


    The Prisync V2.0 API aims to provide you all the functions which you are
    already using on the Prisync Dashboard,  be accessible programmatically so
    that you can automate your complex flows.


    In this document, we first talk about the general overview about the
    design, then go into details of endpoints. Each endpoint has clear examples
    in several programming languages for your convenience.




    ## Requests

    HTTP requests can be made with tons of tools, each modern programming
    language has its own HTTP functions and libraries. Luckily, we are living
    in a world supporting hyperconnectivity. All the requests should be made
    with HTTPS to make sure that your data is encrypted. The Prisync API will
    handle each request in a meaningful manner, depending on the action
    required.


     | Method | Usage   |
     | ------ | -------- |
     | GET | For simple retrieval of information about your account, products, URLs, or any other data, you should use the GET method. <br /><br />API will respond you with a JSON object. Using the returned information, you can form additional requests. All the GET requests are made read-only, which means making a GET requests cannot change the state of any information stored on Prisync. |
     | POST   | When you want to create an object and store in on the Prisync, you should choose POST method. The POST request includes all of the attributes necessary to create a new object. |


     ## HTTP Statuses
     When you make a request to the API, you will get a response including the
     data you want with standard HTTP statuses, including error codes.

    In case of an unusual event, such as a record cannot be created because of
    it already exists, the status code will have an error code. Besides that,
    the body of the request will contain additional information about the event
    to provide you the most conventional way to fix the flow.

    To make it clear, status codes are usually in between 2XX-5XX range.

     | Status Code | Meaning |
     | ----------- | ------- |
     | 2XX         | Request is handled successfully, there is no errors. Yay!|
     | 4XX         | There is an issue and we need your attention. A request may return 400 if a required parameter is missing or 404 if the requested record does not exists on earth or if the requested url is wrong. Authorization problems and malformed requests lay in this category as well.|
     | 5XX         | There is a problem on the server-side. It would indicate that we are having an issue or get an unexpected requests. You can always repeat the request.|


     ## Responses
     For each successfull and unsuccessfull request, a JSON-formatted
     response body will be sent back. If you make a request for a single
     object, say, for a <i>Product</i>, the resource root will be a
     single object containing the data you requested. If you request
     a collection, say, a group of <i>Product</i>s, response body will
     contain a collection.


     ## Rate Limit

     The number of requests that can be made through the API is
     currently limited to 2,500 per hour per API token.


     ## Parameters
     You should set apikey and apitoken as HTTP request headers on all
     requests. Your API key is your Prisync login email. You can obtain
     your apitoken on your Prisync dashboard->account.

     Most of HTTP GET requests need querystring parameters.

     Most of HTTP POST requests need POST body parameters.


     For almost all API requests, we provide examples calls with
     cURL command. With a single copy and paste, you can always
     try making a request and see the results.


  version: 2.0.0
  title: Welcome to Prisync API Documentation
  termsOfService: 'http://swagger.io/terms/'
  x-logo:
    url: 'https://app.prisync.com/img/prisync-logo.png'
    backgroundColor: '#2B3545'
securityDefinitions:
  apikey:
    type: apiKey
    in: header
    name: apikey
    description: Your e-mail address that you use to login prisync.com.
  apitoken:
    type: apiKey
    in: header
    name: apitoken
    description: >-
      Your API token where you can find in Settings page of your Prisync
      account.
host: prisync.com
basePath: /api/v2
produces:
  - application/json
tags:
  - name: Product
    description: "
                 A product presenting one of the things that you sell.<br />
                 <br />
                 Products are the physical goods, digital goods, digital
                 downloads or services which have a unique product page in
                 your e-commerce infrastructure.<br />
                 <br />
                 Different products have different attributes and several
                 e-commerce CMS'es such as Magento or Shopify uses different
                 labels for the same attributes. <br />
                 <br />
                 We use the most common attributes to provide to lessen the
                 hassle and make room for the price tracking and dynamic
                 pricing.<br />
                 <br />
                 <h3>Product Attributes</h3>
                 <b>Name:</b> Name of the Product. <b>'iPhone 8'</b>,
                 <b>'MyBook Laptop core i7 16GB'</b> or <b>'Sennheiser Wired
                 Headphone Hd 429 (Black)'</b> are examples of a Product name.
                 Naming your Products is up to your business requirements.
                 <br />
                 <b>Brand:</b>
                 (See <a href='#tag/Brand'><i>Brand</i></a>)<br />
                 <b>Category:</b>
                 (See <a href='#tag/Category'><i>Category</i></a>)<br />
                 <b>Product Code:</b> A custom code attribute allowing you
                 matching your database records with the API results.
                 Some companies use SKU's (Stock Keeping Unit), EAN's
                 (International Article Number), GTIN's (Global Trade Item
                 Number), (or ISBN, UPC etc.)  as a Product code, as well as
                 the others use custom codes. <br />
                 <b>Cost:</b> If you provide the cost of a product (the price
                 that you pay to obtain the item from your supplier or the
                 production cost if you produce that item) Prisync will provide
                 you the dynamic pricing features. (See <a
                 href='https://prisync.com/blog/coming-soon-prisyncs-dynamic-pricing-engine-smartprice/'
                 > our blog post explaining
                 Dynamic Pricing Engine / SmartPrice</a> features for details.
                 "
  - name: URL
    description: "
                  A URL pointing your or one of your competitors product page.
                  Prisync successfully tracks all kinds of product pages from
                  all types of websites so that you should precisely add the
                  product detail page of your own website or your competitor's
                  websites.

                  <br /><br />
                  <i>Example:</i><br />
                  https://www.amazon.com/Hamlet-Folger-Library-Shakespeare-William/dp/074347712X<br />
                  This is a typical product page, including the name of the
                  product, the image of the product and price/stock
                  information. <span style='color:green'>This is the correct
                  type of URL that should be added.</span>

                  <br /><br />
                  <i>A Common Mistake:</i><br />
                  https://www.amazon.com/Drama-Literature-Fiction-Books/b/?&node=2159<br />
                  This is NOT a product page, instead, this is a category
                  listing page.
                  This page includes several different products in a single
                  page and Prisync CANNOT guess which product that you want to
                  track. <span style='color:red'>The API allows adding
                  category listing URLs but Prisync will NOT track them.</span>

                  <br /><br />
                  <i>Another Common Mistake:</i><br />
                  https://www.amazon.com<br />
                  This mistake is actually very similar to the previous one.
                  This URL is NOT a product page URL as well. Amazon sells
                  more than 400 million URLs (2017) and probably you wouldn't
                  want to track all of them. Instead of adding the naked
                  domain name (such as amazon.com, bestbuy.com, amazon.co.uk
                  etc.) you should add the specific URL pointing the product
                  page.
                  You can technically add these type of URLs but
                  <span style='color:red'> Prisync will NOT track them.</span>
                  "
  - name: Brand
    description: "
                 The name of the manufacturer or the supplier of one (or
                 several) Products. <br />
                 <br />
                 Brand names are totally customizable, which means
                 Prisync does not provide you a static Brand list.
                 Instead, you can define your own Brands. <br />
                 <br />
                 Brands are defined via <i>/add/product</i> endpoint.
                 If the Brand you provided in your add product request
                 already exists in your account, we only add your Product
                 to the given Brand. If the Brand doesn't exists in
                 your account, the API will create that Brand on behalf
                 of you automatically. <br />
                 <br />
                 So that, there is no need to make extra Brand create
                 requests.
                 "
  - name: Category
    description: "
                 A group name including similar Products. <br />
                 <br />
                 Category names are totally customizable, which means
                 Prisync does not provide you a static Category list.
                 Instead, you can define your own Categories. <br />
                 <br />
                 Categories are defined via <i>/add/product</i> endpoint.
                 If the Category you provided in your add product request
                 already exists in your account, we only add your Product
                 to the given Category. If the Category doesn't exists in
                 your account, the API will create that Category on behalf
                 of you automatically. <br />
                 <br />
                 So that, there is no need to make extra Category create
                 requests.
                 "
  - name: account
    description: "
                 We provide a brief info about your account via this endpoint.
                 Basically, this endpoint returns your Prisync plan type,
                 number of products that your plan includes and your account
                 status.<br />
                 <br />
                 "
paths:
  /account:
    get:
      summary: Returns account info
      description: "
                   This endpoint returns your account details.<br />
                   "
      operationId: getAccountDetails
      security:
        - apikey: []
        - apitoken: []
      tags:
        - account
      x-code-samples:
        - lang: cURL
          source: |-
            curl -X GET
            https://prisync.com/api/v2/account/
            -H 'apikey: Your API_KEY'
            -H 'apitoken: Your API_TOKEN'
        - lang: PHP
          source: |-
            $ch = curl_init();

            curl_setopt($ch, CURLOPT_URL, "https://prisync.com/api/v2/account");
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

            $headers = array();
            $headers[] = "apikey: Your API_KEY";
            $headers[] = "apitoken: Your API_TOKEN";
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            $response = curl_exec($ch);
            $err = curl_error($ch);

            curl_close($ch);

            if ($err) {
              echo "cURL Error #:" . $err;
            } else {
              echo $response;
            }
      responses:
        '200':
          description: An object contains your account details.
          schema:
            $ref: '#/definitions/AccountResult'
        '401':
          description: Requested account not authorized to access to API.
          schema:
            $ref: '#/definitions/Error'
  '/list/product/startFrom/{startFrom}':
    get:
      summary: List all products in your account
      description: >-
        This endpoint returns information about the products that have been
        added to Prisync via web UI or the API. The result is paginated. Each
        page contains up to 100 products.

      operationId: listProducts
      security:
        - apikey: []
        - apitoken: []
      parameters:
        - name: startFrom
          in: path
          type: number
          format: integer
          description: >-
            Offset for pagination. It can take 0 and exact
            multiples of 100 as a value.
            <br><br>**P.S.**: Actually, startFrom is an optional parameter.
            When not provided, this method returns the first page only.
            So that, calling without startFrom is equivalent to startFrom/0.
          required: true

      tags:
        - Product
      x-code-samples:
        - lang: cURL
          source: |-
            curl -X GET
            https://prisync.com/api/v2/list/product/startFrom/0
              -H 'apikey: Your API_KEY'
              -H 'apitoken: Your API_TOKEN'
        - lang: PHP
          source: |-
            $curl = curl_init();
            curl_setopt_array($curl, array(
              CURLOPT_URL => "https://prisync.com/api/v2/list/product/startFrom/0",
              CURLOPT_RETURNTRANSFER => true,
              CURLOPT_CUSTOMREQUEST => "GET",
              CURLOPT_HTTPHEADER => array(
                "apikey: Your API_KEY",
                "apitoken: Your API_TOKEN",
              ),
            ));

            $response = curl_exec($curl);
            $err = curl_error($curl);

            curl_close($curl);

            if ($err) {
              echo "cURL Error #:" . $err;
            } else {
              echo $response;
            }
      responses:
        '200':
          description: "An object contains an array of products and next
                        page link."
          schema:
            $ref: '#/definitions/ListProduct'
        '404':
          description: Requested product list not found.
          schema:
            $ref: '#/definitions/Error'
  '/list/product/summary/startFrom/{startFrom}':
    get:
      summary: List all products in your account with price information
      description: >-
        This endpoint returns information about the products including price information that have been
        added to Prisync via web UI or the API. The result is paginated. Each
        page contains up to 100 products.

      operationId: listProductsWithPrice
      security:
        - apikey: []
        - apitoken: []
      parameters:
        - name: summary
          in: path
          type: string
          description: >-
            A keyword to obtain all price information related to the product.
          required: true
        - name: startFrom
          in: path
          type: number
          format: integer
          description: >-
            Offset for pagination. It can take 0 and exact
            multiples of 100 as a value.
            <br><br>**P.S.**: Actually, startFrom is an optional parameter.
            When not provided, this method returns the first page only.
            So that, calling without startFrom is equivalent to startFrom/0.
          required: true

      tags:
        - Product
      x-code-samples:
        - lang: cURL
          source: |-
            curl -X GET
            https://prisync.com/api/v2/list/product/summary/startFrom/0
              -H 'apikey: Your API_KEY'
              -H 'apitoken: Your API_TOKEN'
        - lang: PHP
          source: |-
            $curl = curl_init();
            curl_setopt_array($curl, array(
              CURLOPT_URL => "https://prisync.com/api/v2/list/product/summary/startFrom/0",
              CURLOPT_RETURNTRANSFER => true,
              CURLOPT_CUSTOMREQUEST => "GET",
              CURLOPT_HTTPHEADER => array(
                "apikey: Your API_KEY",
                "apitoken: Your API_TOKEN",
              ),
            ));

            $response = curl_exec($curl);
            $err = curl_error($curl);

            curl_close($curl);

            if ($err) {
              echo "cURL Error #:" . $err;
            } else {
              echo $response;
            }
      responses:
        '200':
          description: "An object contains an array of products with price summary information
                        and next page link."
          schema:
            $ref: '#/definitions/ListProductWithSummary'
        '404':
          description: Requested product list not found.
          schema:
            $ref: '#/definitions/Error'
  '/list/smartprice/startFrom/{startFrom}':
    get:
      summary: List SmartPrices for all products in your account
      description: >-
        This endpoint returns product id, product code, barcode and SmartPrice information about the products that have been
        added to Prisync via web UI or the API. The result is paginated. Each
        page contains up to 100 products.

      operationId: listProductsWithSmartPrice
      security:
        - apikey: []
        - apitoken: []
      parameters:
        - name: startFrom
          in: path
          type: number
          format: integer
          description: >-
            Offset for pagination. It can take 0 and exact
            multiples of 100 as a value.
            <br><br>**P.S.**: Actually, startFrom is an optional parameter.
            When not provided, this method returns the first page only.
            So that, calling without startFrom is equivalent to startFrom/0.
          required: true

      tags:
        - Product
      x-code-samples:
        - lang: cURL
          source: |-
            curl -X GET
            https://prisync.com/api/v2/list/smartprice/startFrom/0
              -H 'apikey: Your API_KEY'
              -H 'apitoken: Your API_TOKEN'
        - lang: PHP
          source: |-
            $curl = curl_init();
            curl_setopt_array($curl, array(
              CURLOPT_URL => "https://prisync.com/api/v2/list/smartprice/startFrom/0",
              CURLOPT_RETURNTRANSFER => true,
              CURLOPT_CUSTOMREQUEST => "GET",
              CURLOPT_HTTPHEADER => array(
                "apikey: Your API_KEY",
                "apitoken: Your API_TOKEN",
              ),
            ));

            $response = curl_exec($curl);
            $err = curl_error($curl);

            curl_close($curl);

            if ($err) {
              echo "cURL Error #:" . $err;
            } else {
              echo $response;
            }
      responses:
        '200':
          description: "An object contains an array of products with product id and SmartPrice information
                        and next page link."
          schema:
            $ref: '#/definitions/ListSmartPrice'
        '404':
          description: Requested SmartPrice list not found.
          schema:
            $ref: '#/definitions/Error'
  '/list/brand/startFrom/{startFrom}':
    get:
      summary: List all brands in the store
      description: >-
        This endpoint returns list of your brands. The response is paginated
        and it can show 100 brands at a time.

      operationId: listBrands
      security:
        - apikey: []
        - apitoken: []
      parameters:
        - name: startFrom
          in: path
          description: >-
            Offset for pagination. It can take 0 and exact
            multiples of 100 as a value.
            <br><br>**P.S.**: Actually, startFrom is an optional parameter.
            When not provided, this method returns the first page only.
            So that, calling without startFrom is equivalent to startFrom/0.
          required: true
          type: number
          format: integer
      tags:
        - Brand
      x-code-samples:
        - lang: cURL
          source: |-
            curl -X GET
            https://prisync.com/api/v2/list/brand/startFrom/0
              -H 'apikey: Your API_KEY'
              -H 'apitoken: Your API_TOKEN'
        - lang: PHP
          source: |-
            $curl = curl_init();
            curl_setopt_array($curl, array(
              CURLOPT_URL => "https://prisync.com/api/v2/list/brand/startFrom/0",
              CURLOPT_RETURNTRANSFER => true,
              CURLOPT_CUSTOMREQUEST => "GET",
              CURLOPT_HTTPHEADER => array(
                "apikey: Your API_KEY",
                "apitoken: Your API_TOKEN",
              ),
            ));

            $response = curl_exec($curl);
            $err = curl_error($curl);

            curl_close($curl);

            if ($err) {
              echo "cURL Error #:" . $err;
            } else {
              echo $response;
            }
      responses:
        '200':
          description: "An object contains an array of brands and next page
                        link."
          schema:
            $ref: '#/definitions/ListBrand'
        '404':
          description: Requested brand list not found.
          schema:
            $ref: '#/definitions/Error'
  '/list/category/startFrom/{startFrom}':
    get:
      summary: List all categories in the store
      description: >-
        This endpoint returns list of your categories. The response is
        paginated and it can show 100 categories at a time.

      operationId: listCategories
      security:
        - apikey: []
        - apitoken: []
      parameters:
        - name: startFrom
          in: path
          description: >-
            Offset for pagination. It can take 0 and exact
            multiples of 100 as a value.
            <br><br>**P.S.**: Actually, startFrom is an optional parameter.
            When not provided, this method returns the first page only.
            So that, calling without startFrom is equivalent to startFrom/0.
          required: true
          type: number
          format: integer
      tags:
        - Category
      x-code-samples:
        - lang: cURL
          source: |-
            curl -X GET
            https://prisync.com/api/v2/list/category/startFrom/0
              -H 'apikey: Your API_KEY'
              -H 'apitoken: Your API_TOKEN'
        - lang: PHP
          source: |-
            $curl = curl_init();
            curl_setopt_array($curl, array(
              CURLOPT_URL => "https://prisync.com/api/v2/list/category/startFrom/0",
              CURLOPT_RETURNTRANSFER => true,
              CURLOPT_CUSTOMREQUEST => "GET",
              CURLOPT_HTTPHEADER => array(
                "apikey: Your API_KEY",
                "apitoken: Your API_TOKEN",
              ),
            ));

            $response = curl_exec($curl);
            $err = curl_error($curl);

            curl_close($curl);

            if ($err) {
              echo "cURL Error #:" . $err;
            } else {
              echo $response;
            }
      responses:
        '200':
          description: "An object contains an array of categories and next
                       page link."
          schema:
            $ref: '#/definitions/ListCategory'
        '404':
          description: Requested category list not found.
          schema:
            $ref: '#/definitions/Error'
  '/get/product/id/{id}':
    get:
      summary: Get a particular product
      description: "
                   This endpoint returns product info with given id.
                   "

      operationId: getProductByID
      security:
        - apikey: []
        - apitoken: []
      parameters:
        - name: id
          in: path
          description: Unique id of the product
          required: true
          type: number
          format: integer
      tags:
        - Product
      x-code-samples:
        - lang: cURL
          source: |-
            curl -X GET
            https://prisync.com/api/v2/get/product/id/1
              -H 'apikey: Your API_KEY'
              -H 'apitoken: Your API_TOKEN'
        - lang: PHP
          source: |-
            $curl = curl_init();
            curl_setopt_array($curl, array(
              CURLOPT_URL => "https://prisync.com/api/v2/get/product/id/1",
              CURLOPT_RETURNTRANSFER => true,
              CURLOPT_CUSTOMREQUEST => "GET",
              CURLOPT_HTTPHEADER => array(
                "apikey: Your API_KEY",
                "apitoken: Your API_TOKEN",
              ),
            ));

            $response = curl_exec($curl);
            $err = curl_error($curl);

            curl_close($curl);

            if ($err) {
              echo "cURL Error #:" . $err;
            } else {
              echo $response;
            }
      responses:
        '200':
          description: A product object contains attached URL ids.
          schema:
            $ref: '#/definitions/SingleProduct'
        '404':
          description: Requested product not found.
          schema:
            $ref: '#/definitions/Error'
  '/get/brand/id/{id}':
    get:
      summary: Get a specific brand
      description: "
                   This endpoint returns brand info with given id.<br />
                   "

      operationId: getBrandByID
      security:
        - apikey: []
        - apitoken: []
      parameters:
        - name: id
          in: path
          description: Unique id of the brand
          required: true
          type: number
          format: integer
      tags:
        - Brand
      x-code-samples:
        - lang: cURL
          source: |-
            curl -X GET
            https://prisync.com/api/v2/get/brand/id/1
            -H 'apikey: Your API_KEY'
            -H 'apitoken: Your API_TOKEN'
        - lang: PHP
          source: |-
            $curl = curl_init();
            curl_setopt_array($curl, array(
              CURLOPT_URL => "https://prisync.com/api/v2/get/brand/id/1",
              CURLOPT_RETURNTRANSFER => true,
              CURLOPT_CUSTOMREQUEST => "GET",
              CURLOPT_HTTPHEADER => array(
                "apikey: Your API_KEY",
                "apitoken: Your API_TOKEN",
              ),
            ));

            $response = curl_exec($curl);
            $err = curl_error($curl);

            curl_close($curl);

            if ($err) {
              echo "cURL Error #:" . $err;
            } else {
              echo $response;
            }
      responses:
        '200':
          description: A brand object contains unique id and name.
          schema:
            $ref: '#/definitions/Brand'
        '404':
          description: Requested brand not found.
          schema:
            $ref: '#/definitions/Error'
  '/get/category/id/{id}':
    get:
      summary: Get a specific category
      description: "This endpoint returns category info with given id.<br />
                   "

      operationId: getCategoryByID
      security:
        - apikey: []
        - apitoken: []
      parameters:
        - name: id
          in: path
          description: Unique id of the category
          required: true
          type: number
          format: integer
      tags:
        - Category
      x-code-samples:
        - lang: cURL
          source: |-
            curl -X GET
            https://prisync.com/api/v2/get/category/id/1
            -H 'apikey: Your API_KEY'
            -H 'apitoken: Your API_TOKEN'
        - lang: PHP
          source: |-
            $curl = curl_init();
            curl_setopt_array($curl, array(
              CURLOPT_URL => "https://prisync.com/api/v2/get/category/id/1",
              CURLOPT_RETURNTRANSFER => true,
              CURLOPT_CUSTOMREQUEST => "GET",
              CURLOPT_HTTPHEADER => array(
                "apikey: Your API_KEY",
                "apitoken: Your API_TOKEN",
              ),
            ));

            $response = curl_exec($curl);
            $err = curl_error($curl);

            curl_close($curl);

            if ($err) {
              echo "cURL Error #:" . $err;
            } else {
              echo $response;
            }
      responses:
        '200':
          description: A category object contains unique id and name.
          schema:
            $ref: '#/definitions/Category'
        '404':
          description: Requested category not found.
          schema:
            $ref: '#/definitions/Error'
  '/get/url/id/{id}':
    get:
      summary: Get a specific URL
      description: "
                   This endpoint returns URL info with given id. <br />
                   <br />
                   <h3>Tip:</h3>
                   When you want to get all URLs belonging to a particular
                   product, first you should make a request for getting
                   the details of the product (See <a
                   href='#operation/getProductByID'
                   ><i>get product</i>.</a>).
                   That request will return an array of URL id's in the
                   response. Using those URL id's, you can get exact
                   URL (<i>the actual address</i>) using <i>this</i>
                   endpoint.
                   "

      operationId: getURLByID
      security:
        - apikey: []
        - apitoken: []
      parameters:
        - name: id
          in: path
          description: Unique id of the URL
          required: true
          type: number
          format: integer
      tags:
        - URL
      x-code-samples:
        - lang: cURL
          source: |-
            curl -X GET
            https://prisync.com/api/v2/get/url/id/1
            -H 'apikey: Your API_KEY'
            -H 'apitoken: Your API_TOKEN'
        - lang: PHP
          source: |-
            $curl = curl_init();
            curl_setopt_array($curl, array(
              CURLOPT_URL => "https://prisync.com/api/v2/get/url/id/1",
              CURLOPT_RETURNTRANSFER => true,
              CURLOPT_CUSTOMREQUEST => "GET",
              CURLOPT_HTTPHEADER => array(
                "apikey: Your API_KEY",
                "apitoken: Your API_TOKEN",
              ),
            ));

            $response = curl_exec($curl);
            $err = curl_error($curl);

            curl_close($curl);

            if ($err) {
              echo "cURL Error #:" . $err;
            } else {
              echo $response;
            }
      responses:
        '200':
          description: A URL object contains unique id and url.
          schema:
            $ref: '#/definitions/Url'
        '404':
          description: Requested URL not found.
          schema:
            $ref: '#/definitions/Error'
  /add/product:
    post:
      summary: Add a new product
      description: >-
        This end point can be used on adding a new product to your Prisync
        account.
      operationId: addProduct
      security:
        - apikey: []
        - apitoken: []
      consumes:
        - multipart/form-data
      parameters:
        - name: name
          in: formData
          description: Product name
          required: true
          type: string
          example: iPhone 13
        - name: brand
          in: formData
          description: Brand name
          required: true
          type: string
          example: Apple
        - name: category
          in: formData
          description: Category name
          required: true
          type: string
          example: Mobile Phones
        - name: product_code
          in: formData
          description: Product code
          required: false
          type: string
          example: AP12-PRO
        - name: barcode
          in: formData
          description: Barcode
          required: false
          type: string
          example: 194252022191
        - name: cost
          in: formData
          description: Product cost
          required: false
          type: string
          example: '859'
        - name: additional_cost
          in: formData
          description: Additional cost
          required: false
          type: string
          example: '40'
        - name: tags
          in: formData
          description: Product tags
          required: false
          type: string
          example: Tag1, tag2, tag name4, tag_name3
      tags:
        - Product
      x-code-samples:
        - lang: cURL
          source: |-
            curl -X POST
            https://prisync.com/api/v2/add/product/
            -H 'apikey: Your API_KEY'
            -H 'apitoken: Your API_TOKEN'
            -H 'content-type: multipart/form-data'
            -F 'name=Test Product'
            -F 'brand=Test Brand'
            -F 'category=Test Category'
            -F 'product_code=TST001'
            -F 'barcode=194252022191'
            -F 'cost=100'
            -F 'additional_cost=40'
            -F 'tags=Tag1, tag2, tag name4, tag_name3'
        - lang: PHP
          source: >-
            $ch = curl_init();


            curl_setopt($ch, CURLOPT_URL,
            "https://prisync.com/api/v2/add/product/");

            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

            curl_setopt($ch, CURLOPT_POST, 1);


            $data = array();

            $data["name"] = "Test Product";

            $data["brand"] = "Test Brand";

            $data["category"] = "Test Category";

            $data["product_code"] = "TST001";

            $data["barcode"] = "194252022191";

            $data["cost"] = "100";
            
            $data["additional_cost"] = "40";
            
            $data["tags"] = "Tag1, tag2, tag name4, tag_name3";


            $headers = array();

            $headers[] = "apikey: Your API_KEY";

            $headers[] = "apitoken: Your API_TOKEN";

            $headers[] = "Content-Type: multipart/form-data";


            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            curl_setopt($ch, CURLOPT_POSTFIELDS, $data);


            $response = curl_exec($ch);

            $err = curl_error($ch);


            curl_close($ch);


            if ($err) {
              echo "cURL Error #:" . $err;
            } else {
              echo $response;
            }
      responses:
        '200':
          description: >-
            A successful response object contains unique id of the new product
            and result status.
          schema:
            $ref: '#/definitions/SuccessResult'
        '400':
          description: Missing or incorrect parameter.
          schema:
            $ref: '#/definitions/Error'
        '404':
          description: Requested object not found.
          schema:
            $ref: '#/definitions/Error'
        '405':
          description: This method is not allowed.
          schema:
            $ref: '#/definitions/Error'
        '422':
          description: This object already exists.
          schema:
            $ref: '#/definitions/Error'
  /add/url:
    post:
      summary: Add a new URL to given product
      description: "
                   Add a URL to a particular product. You can add your own URL
                   or a competitor's URL to one of your products.
                   <h3>Tip</h3>
                   Let's say you want to add your first product (e.g. MyBook
                   Laptop Core i7 16GB) using the API. First, you should add
                   a product using
                   <a href='#operation/addProduct'>
                   <i>add product</i></a> endpoint. <i>Add product</i> endpoint
                   returns the newly created product's id in the response.
                   Now it's time to add your own URL. For the sake of the
                   example, let's assume your website is
                   'https://mybook.com' and the product page of MyBook Laptop
                   Core i7 16GB is
                   'https://mybook.com/187728/MyBook-Corei7-16GB'. <br />
                   <br />
                   At this point, you have a product id and a URL address.
                   Just make a request to <i>add URL</i> endpoint and voilà.
                   You've just starting tracking your first product and your
                   first URL.</br >
                   <br />
                   Now you can add your competitors URLs using the same product
                   id, then Prisync will going to handle the rest, collect the
                   data automatically.
                   "
      operationId: addURLToGivenProduct
      security:
        - apikey: []
        - apitoken: []
      consumes:
        - multipart/form-data
      parameters:
        - name: product_id
          in: formData
          description: Product id which you want to add a URL.
          required: true
          type: integer
          example: '86493'
        - name: url
          in: formData
          description: Url
          required: true
          type: string
          example: 'https://www.amazon.com/apple-iphone-13'
      tags:
        - URL
      x-code-samples:
        - lang: cURL
          source: |-
            curl -X POST
            https://prisync.com/api/v2/add/url/
            -H 'apikey: Your API_KEY'
            -H 'apitoken: Your API_TOKEN'
            -F 'product_id=123'
            -F 'url=http://example.com/product/1'
        - lang: PHP
          source: >-
            $ch = curl_init();


            curl_setopt($ch, CURLOPT_URL,
            "https://prisync.com/api/v2/add/url/");

            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

            curl_setopt($ch, CURLOPT_POST, 1);


            $data = array();

            $data["product_id"] = "123";

            $data["url"] = "http://example.com/product/1";


            $headers = array();

            $headers[] = "apikey: Your API_KEY";

            $headers[] = "apitoken: Your API_TOKEN";

            $headers[] = "Content-Type: multipart/form-data";


            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            curl_setopt($ch, CURLOPT_POSTFIELDS, $data);


            $response = curl_exec($ch);

            $err = curl_error($ch);


            curl_close($ch);


            if ($err) {
              echo "cURL Error #:" . $err;
            } else {
              echo $response;
            }
      responses:
        '200':
          description: >-
            A successful response object contains unique id of the new URL and
            result status.
          schema:
            $ref: '#/definitions/SuccessResult'
        '400':
          description: Missing or incorrect parameter.
          schema:
            $ref: '#/definitions/Error'
        '404':
          description: Requested object not found.
          schema:
            $ref: '#/definitions/Error'
        '405':
          description: This method is not allowed.
          schema:
            $ref: '#/definitions/Error'
        '422':
          description: This object already exists.
          schema:
            $ref: '#/definitions/Error'
  /add/batch:
    post:
      summary: Create multiple products (bulk add)
      description: "This endpoint can be used on adding more than one product
                   at a time.<br />
                   <br />
                   You can make a request to this endpoint whenever you want to
                   add more than one product. Instead of writing for loops around
                   <i>/add/product</i> calls, you can wrap your all products into
                   just a single request.<br />
                   <br />
                   This request is very similar to <i>/add/product</i>, the only
                   difference lays in the parameter structure. Instead of
                   only one product name, brand, category, product_code and price,
                   you need to add an array of those.<br />
                   <br />
                   A clear example adding two products in a single request is
                   shown on the right hand side of  this page.
                   "
      operationId: importProducts
      security:
        - apikey: []
        - apitoken: []
      consumes:
        - multipart/form-data
      parameters:
        - name: productList
          in: formData
          description: "
                       This is a list of products where you need to add each product is
                       an element of the parameter array and each element should contain
                       name, brand, category, product_code and cost fields.
                       (See the example on the right column.)<br />
                       <br />
                       You can see an example of product from
                       <a href='#operation/addProduct'>here</a>.
                       "
          required: true
          type: array
          items:
            type: array
            items:
              type: string
          collectionFormat: multi
        - name: cancelOnPackageLimitExceeding
          in: formData
          description: "We do not accept package limit exceeding requests by default. You can set this
                       parameter to **false** if you want to import first allowed number of products.
                       <br /><br />
                       **E.g.** Your package limit is 1000 products and you have 850 products already in
                       your panel.
                       <br /><br />
                       If you try to import 500 new products, it will cause an error (422 - Package limit exceeded)
                       by default.
                       <br /><br />
                       If this parameter set as **false**, system will import first 150 products.
                       "
          default: 'true'
          type: string
          enum: ['true', 'false']
      tags:
        - Product
      x-code-samples:
        - lang: cURL
          source: |-
            curl -X POST
            https://prisync.com/api/v2/add/batch/
            -H 'apikey: Your API_KEY'
            -H 'apitoken: Your API_TOKEN'
            -H 'content-type: multipart/form-data'
            -F 'product0[name]=Test Product 1'
            -F 'product0[brand]=Test Brand'
            -F 'product0[category]=Test Category'
            -F 'product0[product_code]=TST001'
            -F 'product0[barcode]=194252022191'
            -F 'product0[cost]=100'
            -F 'product0[additional_cost]=20'
            -F 'product1[name]=Test Product 2'
            -F 'product1[brand]=Test Brand 2'
            -F 'product1[category]=Test Category 2'
            -F 'product1[product_code]=TST002'
            -F 'product1[barcode]=194252022192'
            -F 'product1[cost]=200'
            -F 'product1[additional_cost]=40'
            -F 'cancelOnPackageLimitExceeding=false'
        - lang: PHP
          source: >-
            $ch = curl_init();


            curl_setopt($ch, CURLOPT_URL,
            "https://prisync.com/api/v2/add/batch/");

            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

            curl_setopt($ch, CURLOPT_POST, 1);


            $product1 = $product2 = $data = array();


            $product1["name"] = "Test Product 1";

            $product1["brand"] = "Test Brand";

            $product1["category"] = "Test Category";

            $product1["product_code"] = "TST001";

            $product1["barcode"] = "194252022191";

            $product1["cost"] = "100";
            
            $product1["additional_cost"] = "20";


            $product2["name"] = "Test Product 2";

            $product2["brand"] = "Test Brand 2";

            $product2["category"] = "Test Category 2";

            $product2["product_code"] = "TST002";

            $product2["barcode"] = "194252022192";

            $product2["cost"] = "200";
            
            $product1["additional_cost"] = "40";

            $cancelOnPackageLimitExceeding = "false";


            $data['product1'] = $product1;

            $data['product2'] = $product2;

            $data['cancelOnPackageLimitExceeding'] = $cancelOnPackageLimitExceeding;


            $headers = array();

            $headers[] = "apikey: Your API_KEY";

            $headers[] = "apitoken: Your API_TOKEN";


            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));


            $response = curl_exec($ch);

            $err = curl_error($ch);


            curl_close($ch);


            if ($err) {
              echo "cURL Error #:" . $err;
            } else {
              echo $response;
            }
      responses:
        '200':
          description: A successful response object contains progress result.
          schema:
            $ref: '#/definitions/ProgressResult'
        '400':
          description: "Missing or incorrect parameter. / Post data is empty, it should not be empty."
          schema:
            $ref: '#/definitions/Error'
        '422':
          description: "This list already in the process queue. / Package limit exceeded."
          schema:
            $ref: '#/definitions/Error'
  '/edit/brand/id/{id}':
    post:
      summary: Change the name of a particular brand
      description: "
                   This endpoint can be used on editing brand name with given
                   id.<br />
                   "
      operationId: editBrandByID
      security:
        - apikey: []
        - apitoken: []
      consumes:
        - multipart/form-data
      parameters:
        - name: id
          in: path
          description: Unique id of the brand
          required: true
          type: number
          format: integer
          example: '8762'
        - name: name
          in: formData
          description: New brand name
          required: true
          type: string
          example: Samsung
      tags:
        - Brand
      x-code-samples:
        - lang: cURL
          source: |-
            curl -X POST
            https://prisync.com/api/v2/edit/brand/id/123
            -H 'apikey: Your API_KEY'
            -H 'apitoken: Your API_TOKEN'
            -H 'content-type: multipart/form-data'
            -F 'name=Test Brand'
        - lang: PHP
          source: >-
            $ch = curl_init();


            curl_setopt($ch, CURLOPT_URL,
            "https://prisync.com/api/v2/edit/brand/id/123");

            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

            curl_setopt($ch, CURLOPT_POST, 1);


            $data = array();

            $data["name"] = "Test Brand";


            $headers = array();

            $headers[] = "apikey: Your API_KEY";

            $headers[] = "apitoken: Your API_TOKEN";

            $headers[] = "Content-Type: multipart/form-data";


            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            curl_setopt($ch, CURLOPT_POSTFIELDS, $data);


            $response = curl_exec($ch);

            $err = curl_error($ch);


            curl_close($ch);


            if ($err) {
              echo "cURL Error #:" . $err;
            } else {
              echo $response;
            }
      responses:
        '200':
          description: >-
            A successful response object contains unique id of the brand and
            result status.
          schema:
            $ref: '#/definitions/SuccessResult'
        '400':
          description: Missing or incorrect parameter.
          schema:
            $ref: '#/definitions/Error'
        '404':
          description: Requested object not found.
          schema:
            $ref: '#/definitions/Error'
        '405':
          description: This method is not allowed.
          schema:
            $ref: '#/definitions/Error'
  '/edit/category/id/{id}':
    post:
      summary: Change the name of a particular category
      description: "
                   This endpoint can be used on editing category name with
                   given id.<br />
                   "
      operationId: editCategoryByID
      security:
        - apikey: []
        - apitoken: []
      consumes:
        - multipart/form-data
      parameters:
        - name: id
          in: path
          description: Unique id of the category
          required: true
          type: number
          format: integer
          example: '4953'
        - name: name
          in: formData
          description: New category name
          required: true
          type: string
          example: Computers
      tags:
        - Category
      x-code-samples:
        - lang: cURL
          source: |-
            curl -X POST
            https://prisync.com/api/v2/edit/category/id/123
            -H 'apikey: Your API_KEY'
            -H 'apitoken: Your API_TOKEN'
            -H 'content-type: multipart/form-data'
            -F 'name=Test Category'
        - lang: PHP
          source: >-
            $ch = curl_init();


            curl_setopt($ch, CURLOPT_URL,
            "https://prisync.com/api/v2/edit/category/id/123");

            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

            curl_setopt($ch, CURLOPT_POST, 1);


            $data = array();

            $data["name"] = "Test Category";


            $headers = array();

            $headers[] = "apikey: Your API_KEY";

            $headers[] = "apitoken: Your API_TOKEN";

            $headers[] = "Content-Type: multipart/form-data";


            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            curl_setopt($ch, CURLOPT_POSTFIELDS, $data);


            $response = curl_exec($ch);

            $err = curl_error($ch);


            curl_close($ch);


            if ($err) {
              echo "cURL Error #:" . $err;
            } else {
              echo $response;
            }
      responses:
        '200':
          description: >-
            A successful response object contains unique id of the category and
            result status.
          schema:
            $ref: '#/definitions/SuccessResult'
        '400':
          description: Missing or incorrect parameter.
          schema:
            $ref: '#/definitions/Error'
        '404':
          description: Requested object not found.
          schema:
            $ref: '#/definitions/Error'
        '405':
          description: This method is not allowed.
          schema:
            $ref: '#/definitions/Error'
  '/edit/product/id/{id}':
    post:
      summary: >-
        Edit Product
      description: >-
        This endpoint can be used for changing name, brand,
        category, product code, barcode or product cost of given
        product. <br />
        <br />
        This is a overwriting operation. The product will be
        updated with the new values that you send within the
        request.<br />
        <br />
        You can edit one or more (or even all) attribute(s)
        of a product in a single request. Product id is a
        read-only value so that it is immutable.<br />
        <br />
      operationId: editProductByID
      security:
        - apikey: []
        - apitoken: []
      consumes:
        - multipart/form-data
      parameters:
        - name: id
          in: path
          description: Unique id of the product
          required: true
          type: number
          format: integer
          example: '201206'
        - name: name
          in: formData
          description: Product name
          required: false
          type: string
          example: Samsung S8
        - name: brand
          in: formData
          description: Brand name
          required: false
          type: string
          example: Samsung
        - name: category
          in: formData
          description: Category name
          required: false
          type: string
          example: Mobile Phones
        - name: tags
          in: formData
          description: Product tags. Previous tags will be removed and replaced with these.
          required: false
          type: string
          example: Tag1, tag2, tag name4, tag_name3
        - name: product_code
          in: formData
          description: Product code
          required: false
          type: string
          example: G950F
        - name: barcode
          in: formData
          description: Barcode
          required: false
          type: string
          example: 194252022191
        - name: cost
          in: formData
          description: Product cost
          required: false
          type: string
          example: '549'
        - name: additional_cost
          in: formData
          description: Additional cost
          required: false
          type: string
          example: '40'
      tags:
        - Product
      x-code-samples:
        - lang: cURL
          source: |-
            curl -X POST
            https://prisync.com/api/v2/edit/product/id/123
            -H 'apikey: Your API_KEY'
            -H 'apitoken: Your API_TOKEN'
            -H 'content-type: multipart/form-data'
            -F 'name=Test Product Edit'
            -F 'brand=Test Brand'
            -F 'category=Test Category'
            -F 'tags=Tag1, tag2, tag name4, tag_name3'
            -F 'product_code=TST004'
            -F 'barcode=194252022191'
            -F 'cost=299'
            -F 'additional_cost=40'
        - lang: PHP
          source: >-
            $ch = curl_init();


            curl_setopt($ch, CURLOPT_URL,
            "https://prisync.com/api/v2/edit/product/id/123");

            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

            curl_setopt($ch, CURLOPT_POST, 1);


            $data = array();

            $data["name"] = "Test Product Edit";

            $data["brand"] = "Test Brand";

            $data["category"] = "Test Category";
            
            $data["tags"] = "Tag1, tag2, tag name4, tag_name3";

            $data["product_code"] = "TST004";

            $data["cost"] = "299";
            
            $data["additional_cost"] = "40";


            $headers = array();

            $headers[] = "apikey: Your API_KEY";

            $headers[] = "apitoken: Your API_TOKEN";

            $headers[] = "Content-Type: multipart/form-data";


            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            curl_setopt($ch, CURLOPT_POSTFIELDS, $data);


            $response = curl_exec($ch);

            $err = curl_error($ch);


            curl_close($ch);


            if ($err) {
              echo "cURL Error #:" . $err;
            } else {
              echo $response;
            }
      responses:
        '200':
          description: >-
            A successful response object contains unique id of the product and
            result status.
          schema:
            $ref: '#/definitions/SuccessResult'
        '400':
          description: Missing or incorrect parameter.
          schema:
            $ref: '#/definitions/Error'
        '404':
          description: Requested object not found.
          schema:
            $ref: '#/definitions/Error'
        '405':
          description: This method is not allowed.
          schema:
            $ref: '#/definitions/Error'
        '422':
          description: This object already exists.
          schema:
            $ref: '#/definitions/Error'
  '/delete/product/id/{id}':
    post:
      summary: Delete given product and all of attached URLs
      description: "This endpoint can be used on delete product with given id.
                    <br /><br />
                    P.S. Product deletion requires further cleaning so that it may take a few seconds to finish the request."
      operationId: deleteProductByID
      security:
        - apikey: []
        - apitoken: []
      parameters:
        - name: id
          in: path
          description: Unique id of the product
          required: true
          type: number
          format: integer
          example: '29765'
      tags:
        - Product
      x-code-samples:
        - lang: cURL
          source: |-
            curl -X POST
            https://prisync.com/api/v2/delete/product/id/123
            -H 'apikey: Your API_KEY'
            -H 'apitoken: Your API_TOKEN'
        - lang: PHP
          source: >-
            $ch = curl_init();


            curl_setopt($ch, CURLOPT_URL,
            "https://prisync.com/api/v2/delete/product/id/123");

            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

            curl_setopt($ch, CURLOPT_POST, 1);


            $headers = array();

            $headers[] = "apikey: Your API_KEY";

            $headers[] = "apitoken: Your API_TOKEN";


            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);


            $response = curl_exec($ch);

            $err = curl_error($ch);


            curl_close($ch);


            if ($err) {
              echo "cURL Error #:" . $err;
            } else {
              echo $response;
            }
      responses:
        '200':
          description: A successful response object contains result status.
          schema:
            $ref: '#/definitions/SuccessDeleteResult'
        '404':
          description: Requested object not found.
          schema:
            $ref: '#/definitions/Error'
        '405':
          description: This method is not allowed.
          schema:
            $ref: '#/definitions/Error'
  '/delete/url/id/{id}':
    post:
      summary: Delete given URL
      description: "
                   This endppoint can be used on delete url with given
                   id.<br />
                   <br />
                   <h3>Tip</h3>
                   The web is a dynamic environment. Products go out of stock,
                   even they are not sold anymore. Websites move products to
                   different URLs and old URLs start to respond with 404s.
                   Or else,  URL structures change all the time.<br />
                   <br />
                   You can always delete URLs from your account. To delete a
                   URL, you need its URL id. Just make a <i>get</i> request
                   to the product that URL belongs to (using <a
                   href='#operation/getProductByID'>
                   <i>/get/product/id/{id}</i></a> endpoint) and obtain the id
                   of the URL.<br />
                   <br />
                   Now you can use <i>/delete/url</i> endpoint to delete the
                   URL. Don't forget to provide the URL id that you've just
                   obtained.
                   "
      operationId: deleteURLByID
      security:
        - apikey: []
        - apitoken: []
      parameters:
        - name: id
          in: path
          description: Unique id of the URL
          required: true
          type: number
          format: integer
          example: '785764'
      tags:
        - URL
      x-code-samples:
        - lang: cURL
          source: |-
            curl -X POST
            https://prisync.com/api/v2/delete/url/id/123
            -H 'apikey: Your API_KEY'
            -H 'apitoken: Your API_TOKEN'
        - lang: PHP
          source: >-
            $ch = curl_init();


            curl_setopt($ch, CURLOPT_URL,
            "https://prisync.com/api/v2/delete/url/id/123");

            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

            curl_setopt($ch, CURLOPT_POST, 1);


            $headers = array();

            $headers[] = "apikey: Your API_KEY";

            $headers[] = "apitoken: Your API_TOKEN";


            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);


            $response = curl_exec($ch);

            $err = curl_error($ch);


            curl_close($ch);


            if ($err) {
              echo "cURL Error #:" . $err;
            } else {
              echo $response;
            }
      responses:
        '200':
          description: A successful response object contains result status.
          schema:
            $ref: '#/definitions/SuccessDeleteResult'
        '404':
          description: Requested object not found.
          schema:
            $ref: '#/definitions/Error'
        '405':
          description: This method is not allowed.
          schema:
            $ref: '#/definitions/Error'
  /progress/batchImport:
    get:
      summary: Get status of a batch import
      description: 'This endpoint returns progress status of batch import
                    product. <br />
                    <i>/add/batch</i> request works asynchronously which means
                    it returns success immediately, then it adds all the
                    products into a buffer queue, and finally it saves
                    products into Prisync database. You can query this
                    endpoint to get current status of your bulk add.
                   '
      operationId: importProgress
      security:
        - apikey: []
        - apitoken: []
      tags:
        - Product
      x-code-samples:
        - lang: cURL
          source: |-
            curl -X GET
            https://prisync.com/api/v2/progress/batchImport
            -H 'apikey: Your API_KEY'
            -H 'apitoken: Your API_TOKEN'
        - lang: PHP
          source: >-
            $ch = curl_init();


            curl_setopt($ch, CURLOPT_URL,
            "https://prisync.com/api/v2/progress/batchImport");

            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);


            $headers = array();

            $headers[] = "apikey: Your API_KEY";

            $headers[] = "apitoken: Your API_TOKEN";

            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);


            $response = curl_exec($ch);

            $err = curl_error($ch);


            curl_close($ch);


            if ($err) {
              echo "cURL Error #:" . $err;
            } else {
              echo $response;
            }
      responses:
        '200':
          description: A successful response object contains result status.
          schema:
            $ref: '#/definitions/ProgressResult'
        '500':
          description: A general error occurred.
          schema:
            $ref: '#/definitions/Error'
definitions:
  ListProduct:
    type: object
    properties:
      results:
        type: array
        description: A list of Product objects.
        items:
          $ref: '#/definitions/Product'
      nextURL:
        type: string
        description: "
                     For a paginated result, returns the link
                     of the next page so that you can iterate over
                     pages without calculating the number of pages
                     in the result. Returns null if there is no next
                     page.
                     "
  ListProductWithSummary:
      type: object
      properties:
        results:
          type: array
          description: A list of Product objects with price summary information.
          items:
            $ref: '#/definitions/ProductWithSummary'
        nextURL:
          type: string
          description: "
                       For a paginated result, returns the link
                       of the next page so that you can iterate over
                       pages without calculating the number of pages
                       in the result. Returns null if there is no next
                       page.
                       "
  ListSmartPrice:
    type: object
    properties:
      results:
        type: array
        description: A list of Product objects with product id and SmartPrice information.
        items:
          $ref: '#/definitions/SmartPrice'
      nextURL:
        type: string
        description: "
                       For a paginated result, returns the link
                       of the next page so that you can iterate over
                       pages without calculating the number of pages
                       in the result. Returns null if there is no next
                       page.
                       "
  ListBrand:
    type: object
    properties:
      results:
        type: array
        description: An array of brand objects.
        items:
          $ref: '#/definitions/Brand'
      nextURL:
        type: string
        description: Next page request link.
  ListCategory:
    type: object
    properties:
      results:
        type: array
        description: An array of category objects.
        items:
          $ref: '#/definitions/Category'
      nextURL:
        type: string
        description: Next page request link.
  Product:
    type: object
    required:
      - id
      - name
      - brand
      - category
    properties:
      id:
        type: number
        format: integer
        description: Unique identifier representing a specific product.
        example: '435'
      name:
        type: string
        description: Name of product.
        example: Product Test XQ1899
      category:
        $ref: '#/definitions/Category'
      brand:
        $ref: '#/definitions/Brand'
      product_code:
        type: string
        description: Unique product code.
        example: XQ1899
      barcode:
        type: string
        description: Barcode of product.
        example: 194252022191
      cost:
        type: string
        description: Product cost.
        example: '499'
      additional_cost:
        type: string
        description: Additional cost.
        example: '40'
      tags:
        type: string
        description: Product tags.
        example: 'Tag1, tag2, tag name4, tag_name3'
      my_position:
        type: string
        description: 'My Position'
        example: 'cheapest'
  ProductWithSummary:
    type: object
    required:
      - id
      - name
      - brand
      - category
    properties:
      id:
        type: number
        format: integer
        description: Unique identifier representing a specific product.
        example: '435'
      name:
        type: string
        description: Name of product.
        example: Product Test XQ1899
      category:
        $ref: '#/definitions/Category'
      brand:
        $ref: '#/definitions/Brand'
      product_code:
        type: string
        description: Unique product code.
        example: XQ1899
      barcode:
        type: string
        description: Barcode of product.
        example: 194252022191
      cost:
        type: string
        description: Product cost.
        example: '499'
      additional_cost:
        type: string
        description: Additional cost.
        example: '40'
      tags:
        type: string
        description: Product tags.
        example: 'Tag1, tag2, tag name4, tag_name3'
      summary:
        $ref: '#/definitions/Summary'
      my_position:
        type: string
        description: 'My Position'
        example: 'cheapest'
      my_position_total_price:
        type: string
        description: 'My Position Total Price'
        example: 'cheapest'
  SmartPrice:
    type: object
    properties:
      product_id:
        type: number
        format: integer
        description: Unique identifier representing a specific product.
        example: '135'
      product_code:
        type: string
        description: Unique product code.
        example: XQ1899
      barcode:
        type: string
        description: Barcode of product.
        example: 194252022191
      smart_price:
        type: string
        description: >-
          SmartPrice. For more information please visit
          [our blog post.](https://prisync.com/blog/smart-pricing/)
        example: '1,299.90'
      my_position:
        type: string
        description: 'My Position'
        example: 'cheapest'

  Brand:
    type: object
    required:
      - id
      - name
    properties:
      id:
        type: number
        format: integer
        description: Unique identifier representing a specific brand.
        example: '9868'
      name:
        type: string
        description: Name of brand.
        example: Apple
  Category:
    type: object
    required:
      - id
      - name
    properties:
      id:
        type: number
        format: integer
        description: Unique identifier representing a specific category.
        example: '2536'
      name:
        type: string
        description: Name of category.
        example: Mobile Phones
  Summary:
    type: object
    properties:
      competitor_1:
        type: object
        description: Fully qualified domain name of the competitor_1 URL. (e.g. "amazon.com" or "bestbuy.com")
        properties:
          price:
            type: string
            description: Competitor price for the product.
          total_price:
            type: string
            description: Competitor total price for the product.
          stock:
            type: string
            description: Stock information.(true => in stock, false => no stock.)
      competitor_2:
        type: object
        description: Fully qualified domain name of the competitor_2 URL. (e.g. "amazon.com" or "bestbuy.com")
        properties:
          price:
            type: string
            description: Competitor price for the product.
          total_price:
            type: string
            description: Competitor total price for the product.
          stock:
            type: string
            description: Stock information.(true => in stock, false => no stock.)
      competitor_N:
        type: object
        description: Fully qualified domain name of the competitor_N URL. (e.g. "amazon.com" or "bestbuy.com")
        properties:
          price:
            type: string
            description: Competitor price for the product.
          total_price:
            type: string
            description: Competitor total price for the product.
          stock:
            type: string
            description: Stock information.(true => in stock, false => no stock.)
    example:
      amazon.com:
        price: '766.00'
        total_price: '786.00'
        stock: true
      bestbuy.com:
        price: '786.00'
        total_price: '799.00'
        stock: true
  SingleProduct:
    type: object
    required:
      - id
      - name
      - brand
      - category
    properties:
      id:
        type: number
        format: integer
        description: Unique identifier representing a specific product.
        example: '24612'
      name:
        description: Name of the product.
        type: string
        example: Samsung S8
      category:
        $ref: '#/definitions/Category'
      brand:
        $ref: '#/definitions/Brand'
      product_code:
        type: string
        description: Unique product code.
        example: XQ1899
      barcode:
        type: string
        description: Barcode of product.
        example: 194252022191
      cost:
        type: string
        description: Product cost.
        example: '499'
      additional_cost:
        type: string
        description: Additional cost.
        example: '40'
      tags:
        type: string
        description: Product tags.
        example: 'Tag1, tag2, tag name4, tag_name3'
      external_ref:
        type: integer
        description: 'External reference id for products imported from 3rd
                      party apps. Ignore it safely if you are developing
                      for your own CMSs integration. You can always prefer
                      using product_code attribute of Product object.'
        example: '75643231'
      smart_price:
        type: string
        description: >-
          SmartPrice. For more information please visit
          [our blog post.](https://prisync.com/blog/smart-pricing/)
        example: '799'
      my_position:
        type: string
        description: 'My Position'
        example: 'cheapest'
      urls:
        type: array
        items:
          type: integer
          example:
            - '3467'
            - '47387'
  Url:
    type: object
    required:
      - id
      - url
    properties:
      id:
        type: number
        format: integer
        description: Unique identifier representing a specific URL.
        example: '54674'
      url:
        type: string
        description: URL of url.
        example: 'http://www.amazon.com/samsung-s8'
      price:
        type: number
        format: float
        description: Competitor price for the product.
        example: '769.99'
      in_stock:
        type: integer
        description: Stock information. (1 => in stock, 0 => no stock.)
        example: '1'
      last_check:
        type: string
        description: The last datetime that Prisync retrieved this competitor. (Format => YYYY-MM-DD HH:MM:SS)
        example: '2017-10-21 11:22:21'
      change_day:
        type: number
        format: float
        description: Daily price change percent of this competitor for the product.
        example: '0.02'
      currency:
        type: string
        description: Currency of competitor website.
        example: 'USD'
      last_changed:
        type: string
        description: Datetime indicating the last price change date. (Format => DD/MM/YYYY)
        example: '21/10/2017'
      old_price:
        type: number
        format: float
        description: Last known price before the detected price change.
        example: '754.75'
  SuccessResult:
    type: object
    required:
      - id
      - result
    properties:
      id:
        type: number
        format: integer
        description: Unique identifier of the last added object.
        example: '23623'
      result:
        type: boolean
        description: "
                     Returns boolean true when operation is successfull.
                     Returns false otherwise.
                     "
        example: true
  SuccessDeleteResult:
    type: object
    required:
      - result
    properties:
      result:
        type: boolean
        description: "
                     Returns boolean true when operation is successfull.
                     Returns false otherwise.
                     "
        example: true
  Error:
    type: object
    required:
      - error
      - errorCode
    properties:
      error:
        type: string
        description: Error message pointing the root cause of the error.
      errorCode:
        type: string
        description: Error code.
  ProgressResult:
    type: object
    properties:
      message:
        type: string
        description: Message of the progress result.
        example: Completed.
      status:
        type: string
        description: "Current status of the progress. It may be
                      <i>in_progress</i> or <i>finished</i>."
        example: finished
      total:
        type: string
        description: Total count of product list.
        example: '100'
      processed:
        type: string
        description: Count of processed items in the queue.
        example: '100'
      errors:
        type: array
        description: An array of errors if exists.
        items:
          type: string
          example: ['Line 1: Duplicate Product in request. Product Name: Test Product 1',
                    'Line 4: Duplicate Product in database. Product Name: Test Product 2']
  AccountResult:
    type: object
    required:
      - api_enabled
      - package
      - product_limit
      - company_status
      - remaining_trial_days
      - competitor_monitoring_style
    properties:
      package:
        type: string
        description: "
                     The API is only available in Premium and Professional
                     plans. This endpoint returns a single character: 'M' or
                     'L', representing 'Premium' and 'Platinum' plans.<br />
                     <br />
                     <hr />
                     For all plans and details, see:
                     <a href='https://app.prisync.com/pricing'>Plans and
                     Pricing</a>
                     "
        example: M
        required: false
      product_limit:
        type: integer
        description: "
                     The maximum number of products that can be added to your
                     Prisync account. This always returns your package limit
                     if you are subscribed to one of existing plans or
                     returns a custom number (probably more than 5000) if you
                     have a custom plan.
                     <br />
                     This number does not show the number of products that you
                     actually added into your account. This is just the upper
                     limit.<br />
                     <br />
                     You cannot add new Products using API (or using the web
                     interface) if the number of products in your account
                     exceeds your product_limit. <br />
                     <br />
                     "
        example: 1000
      company_status:
        type: string
        description: "
                     A string representing your account status.<br />
                     Values: [in_trial|paid|expired]. The value is usually
                     paid or in_trial, showing that you are already subscribed
                     to one of the plans or you are still in trial period."
        example: in_trial
      remaining_trial_days:
        type: integer
        description: "
                     If you are still in trial period, this attribute returns
                     the number of days remaining for your trial period. If
                     your trial period is over and you are not subscribed,
                     this request returns -1.
                     "
        example: 10
      api_enabled:
        type: boolean
        description: "
                     Always returns boolean <i>true</i> if
                     you have an active subscription plan which includes the
                     API access. Returns boolean <i>false</i> only if you
                     downgrade your account to a plan which does not include
                     the API access.
                     "
        example: true
      competitor_monitoring_style:
        type: string
        description: "
                     A string representing your account monitoring style.<br />
                     Values: [channel_based|url_based]. The value informs the 
                     panel that the URL information will be automatically added 
                     by the system or entered by the user. 
                     If the value is channel_based URLs will be automatically added. 
                     Otherwise, URLs will be added by the user to the panel. ."
        example: url_based
