swagger: "2.0"
schemes:
  - https
host: api.nativeads.com
info:
  description: |
    This is a Native Ads Publisher API it provides same functionality as Native Ads Publisher Account GUI.
  title: Native Ads Publisher API
  version: 1.0.0
  x-apisguru-categories:
    - marketing
  x-logo:
    url: https://api.nativeads.com/docs/publisher/images/nativeads-logo.png
  x-origin:
    - format: swagger
      url: https://api.nativeads.com/docs/publisher/swagger.json
      version: "2.0"
  x-providerName: nativeads.com
produces:
  - application/json
paths:
  /auth/default/login:
    post:
      description: Returns Native Ads Publisher API token
      parameters:
        - description: Native Ads Publisher username
          in: formData
          name: username
          required: true
          type: string
        - description: Native Ads Publisher password
          in: formData
          name: password
          required: true
          type: string
      produces:
        - application/json
      responses:
        "200":
          description: authentication response
          schema:
            $ref: "#/definitions/authResponse"
        "400":
          description: error message
          schema:
            $ref: "#/definitions/modelError"
      tags:
        - auth
  /publisher/reports/daily:
    get:
      description: Returns publisher statistics split by date
      parameters:
        - description: Native Ads Publisher API authentication token
          in: query
          name: token
          required: true
          type: string
        - description: start date in format YYYY-MM-DD
          format: date
          in: query
          name: startDate
          required: true
          type: string
        - description: end date in format YYYY-MM-DD
          format: date
          in: query
          name: endDate
          required: true
          type: string
        - default: 100
          description: maximum number of results per page
          format: int32
          in: query
          name: limit
          required: true
          type: integer
        - default: 1
          description: page number
          format: int32
          in: query
          name: page
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: report response
          schema:
            $ref: "#/definitions/reportsDailyResponse"
        "400":
          description: error message
          schema:
            $ref: "#/definitions/modelError"
      tags:
        - reports
  /publisher/reports/website:
    get:
      description: Returns publisher statistics split by website
      parameters:
        - description: Native Ads Publisher API authentication token
          in: query
          name: token
          required: true
          type: string
        - description: start date in format YYYY-MM-DD
          format: date
          in: query
          name: startDate
          required: true
          type: string
        - description: end date in format YYYY-MM-DD
          format: date
          in: query
          name: endDate
          required: true
          type: string
        - default: 100
          description: maximum number of results per page
          format: int32
          in: query
          name: limit
          required: true
          type: integer
        - default: 1
          description: page number
          format: int32
          in: query
          name: page
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: report response
          schema:
            $ref: "#/definitions/reportsWebsiteResponse"
        "400":
          description: authentication error
          schema:
            $ref: "#/definitions/modelError"
      tags:
        - reports
  /publisher/reports/widget:
    get:
      description: Returns publisher statistics split by widget
      parameters:
        - description: Native Ads Publisher API authentication token
          in: query
          name: token
          required: true
          type: string
        - description: start date in format YYYY-MM-DD
          format: date
          in: query
          name: startDate
          required: true
          type: string
        - description: end date in format YYYY-MM-DD
          format: date
          in: query
          name: endDate
          required: true
          type: string
        - default: 100
          description: maximum number of results per page
          format: int32
          in: query
          name: limit
          required: true
          type: integer
        - default: 1
          description: page number
          format: int32
          in: query
          name: page
          required: true
          type: integer
      produces:
        - application/json
      responses:
        "200":
          description: report response
          schema:
            $ref: "#/definitions/reportsWidgetResponse"
        "400":
          description: authentication error
          schema:
            $ref: "#/definitions/modelError"
      tags:
        - reports
definitions:
  authResponse:
    properties:
      success:
        type: boolean
      token:
        type: string
  modelError:
    properties:
      errors:
        items:
          type: string
        type: array
      success:
        type: boolean
  reportsDailyItem:
    properties:
      clicks:
        type: string
      cpc:
        type: string
      ctr:
        type: string
      date:
        type: string
      earnings:
        type: string
      impressions:
        type: string
      net_ecpm:
        type: string
      rpm:
        type: string
  reportsDailyResponse:
    properties:
      items:
        items:
          $ref: "#/definitions/reportsDailyItem"
          type: object
        type: array
      success:
        type: boolean
      total_count:
        type: integer
      totals:
        $ref: "#/definitions/totals"
        type: object
  reportsWebsiteItem:
    properties:
      clicks:
        type: string
      cpc:
        type: string
      ctr:
        type: string
      date:
        type: string
      earnings:
        type: string
      impressions:
        type: string
      net_ecpm:
        type: string
      rpm:
        type: string
  reportsWebsiteResponse:
    properties:
      items:
        items:
          $ref: "#/definitions/reportsWebsiteItem"
          type: object
        type: array
      success:
        type: boolean
      total_count:
        type: integer
      totals:
        $ref: "#/definitions/totals"
        type: object
  reportsWidgetItem:
    properties:
      campaign:
        description: widget name
        type: string
      campaign_id:
        description: widget id
        type: string
      clicks:
        type: string
      cpc:
        type: string
      ctr:
        type: string
      earnings:
        type: string
      impressions:
        type: string
      net_ecpm:
        type: string
      rpm:
        type: string
  reportsWidgetResponse:
    properties:
      items:
        items:
          $ref: "#/definitions/reportsWidgetItem"
          type: object
        type: array
      success:
        type: boolean
      total_count:
        type: integer
      totals:
        $ref: "#/definitions/totals"
        type: object
  totals:
    properties:
      total_clicks:
        type: string
      total_cpc:
        type: string
      total_ctr:
        type: string
      total_earnings:
        type: string
      total_impressions:
        type: string
      total_net_ecpm:
        type: string
      total_rpm:
        type: string
