---
openapi: 3.0.1
info:
  title: API V1
  version: v1
paths:
  "/v1/organizations":
    get:
      summary: list organizations
      security:
      - api_key: []
      responses:
        '200':
          description: successful
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/organizations_response"
        '401':
          description: Invalid API token
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/auth_error"
  "/v1/organizations/{id}":
    parameters:
    - name: id
      in: path
      description: Organization ID
      required: true
      schema:
        type: string
    get:
      summary: show organization
      security:
      - api_key: []
      responses:
        '200':
          description: successful
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/organization_response"
        '404':
          description: Organization not found
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errors"
        '401':
          description: Invalid API token
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/auth_error"
  "/v1/organizations/{org_id}/reports/{id}/convert_to_premium":
    parameters:
    - name: org_id
      in: path
      description: org_id
      required: true
      schema:
        type: string
    - name: id
      in: path
      description: id
      required: true
      schema:
        type: string
    post:
      summary: convert_to_premium report
      security:
      - api_key: []
      responses:
        '200':
          description: successful
        '422':
          description: Report is already advanced
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errors"
        '404':
          description: Report not found
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errors"
        '401':
          description: Invalid API token
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/auth_error"
  "/v1/organizations/{org_id}/reports/{id}/export_gdocs":
    parameters:
    - name: org_id
      in: path
      description: org_id
      required: true
      schema:
        type: string
    - name: id
      in: path
      description: id
      required: true
      schema:
        type: string
    post:
      summary: export_gdocs report
      security:
      - api_key: []
      responses:
        '200':
          description: successful
        '401':
          description: Invalid API token
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/auth_error"
        '404':
          description: Report not found
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errors"
  "/v1/organizations/{org_id}/reports":
    parameters:
    - name: org_id
      in: path
      description: org_id
      required: true
      schema:
        type: string
    get:
      summary: list reports
      security:
      - api_key: []
      responses:
        '200':
          description: successful
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/reports_response"
        '401':
          description: Invalid API token
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/auth_error"
    post:
      summary: create report
      security:
      - api_key: []
      parameters: []
      responses:
        '200':
          description: successful
        '401':
          description: Invalid API token
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/auth_error"
        '422':
          description: Invalid report type
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errors"
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                query:
                  type: string
                reportType:
                  type: string
                  enum:
                  - standard
                  - advanced
                language:
                  type: string
              required:
              - query
  "/v1/organizations/{org_id}/reports/{id}":
    parameters:
    - name: org_id
      in: path
      description: org_id
      required: true
      schema:
        type: string
    - name: id
      in: path
      description: Report ID
      required: true
      schema:
        type: string
    get:
      summary: show report
      security:
      - api_key: []
      responses:
        '200':
          description: successful
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/report_response"
        '204':
          description: successful
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/report_response"
        '404':
          description: Report not found
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errors"
        '401':
          description: Invalid API token
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/authorize_error"
    put:
      summary: update report
      security:
      - api_key: []
      parameters: []
      responses:
        '200':
          description: successful
        '401':
          description: Invalid API token
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/auth_error"
        '404':
          description: Report not found
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errors"
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                public:
                  type: boolean
  "/v1/publicreports":
    get:
      summary: public_index report
      responses:
        '200':
          description: successful
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/reports_response"
  "/v1/reports/{id}/convert_to_premium":
    parameters:
    - name: id
      in: path
      description: id
      required: true
      schema:
        type: string
    post:
      summary: convert_to_premium report
      security:
      - api_key: []
      deprecated: true
      description: This endpoint is deprecated. Use the /v1/organizations/{org_id}/reports/{id}/convert_to_premium
        endpoint instead.
      responses:
        '200':
          description: successful
        '422':
          description: Report is already advanced
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errors"
        '404':
          description: Report not found
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errors"
        '401':
          description: Invalid API token
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/auth_error"
  "/v1/reports/{id}/export_gdocs":
    parameters:
    - name: id
      in: path
      description: id
      required: true
      schema:
        type: string
    post:
      summary: export_gdocs report
      security:
      - api_key: []
      deprecated: true
      description: This endpoint is deprecated. Use the /v1/organizations/{org_id}/reports/{id}/export_gdocs
        endpoint instead.
      responses:
        '200':
          description: successful
        '401':
          description: Invalid API token
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/auth_error"
        '404':
          description: Report not found
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errors"
  "/v1/reports":
    get:
      summary: list reports
      security:
      - api_key: []
      deprecated: true
      description: This endpoint is deprecated. Use the /v1/organizations/{org_id}/reports
        endpoint instead.
      responses:
        '200':
          description: successful
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/reports_response"
        '401':
          description: Invalid API token
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/auth_error"
    post:
      summary: create report
      security:
      - api_key: []
      deprecated: true
      description: This endpoint is deprecated. Use the /v1/organizations/{org_id}/reports
        endpoint instead.
      parameters: []
      responses:
        '200':
          description: successful
        '401':
          description: Invalid API token
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/auth_error"
        '422':
          description: Invalid report type
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errors"
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                query:
                  type: string
                reportType:
                  type: string
                  enum:
                  - standard
                  - advanced
                language:
                  type: string
              required:
              - query
  "/v1/reports/{id}":
    parameters:
    - name: id
      in: path
      description: Report ID
      required: true
      schema:
        type: string
    get:
      summary: show report
      security:
      - api_key: []
      deprecated: true
      description: This endpoint is deprecated. Use the /v1/organizations/{org_id}/reports/{id}
        endpoint instead.
      responses:
        '200':
          description: successful
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/report_response"
        '204':
          description: successful
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/report_response"
        '404':
          description: Report not found
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errors"
        '401':
          description: Invalid API token
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/authorize_error"
    put:
      summary: update report
      security:
      - api_key: []
      deprecated: true
      description: This endpoint is deprecated. Use the /v1/organizations/{org_id}/reports/{id}
        endpoint instead.
      parameters: []
      responses:
        '200':
          description: successful
        '404':
          description: Report not found
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errors"
        '401':
          description: Invalid API token
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/auth_error"
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                public:
                  type: boolean
  "/v1/stats":
    get:
      summary: list stats
      responses:
        '200':
          description: successful
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/stats_response"
  "/v1/users/me":
    get:
      summary: my user
      security:
      - api_key: []
      responses:
        '200':
          description: successful
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/user_response"
        '401':
          description: Invalid API token
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/auth_error"
    put:
      summary: update my user
      security:
      - api_key: []
      parameters: []
      responses:
        '200':
          description: successful
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/user_response"
        '400':
          description: Invalid parameters
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/errors"
        '401':
          description: Invalid API token
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/auth_error"
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                user:
                  type: object
                  properties:
                    name:
                      type: string
                    notification_preference:
                      type: object
                      properties:
                        report_generated:
                          type: boolean
              required:
              - user
components:
  securitySchemes:
    api_key:
      type: apiKey
      in: header
      name: X-ACCESS-TOKEN
  schemas:
    auth_error:
      type: object
      properties:
        error:
          type: string
          enum:
          - You need to sign in or sign up before continuing.
      required:
      - error
    authorize_error:
      type: object
      properties:
        errors:
          type: array
          items:
            type: string
            enum:
            - Not authorized to perform this action
      required:
      - errors
    errors:
      type: object
      properties:
        errors:
          type: array
          items:
            oneOf:
            - type: string
            - type: object
              properties:
                detail:
                  oneOf:
                  - type: string
                  - type: array
                    items:
                      type: string
      required:
      - errors
    book:
      type: object
      properties:
        title:
          type: string
        isbn:
          type: string
        author:
          type: string
        description:
          type: string
      required:
      - title
      - isbn
      - author
      - description
    books:
      type: array
      items:
        "$ref": "#/components/schemas/book"
    books_response:
      type: object
      properties:
        data:
          type: object
          properties:
            id:
              type: string
            type:
              type: string
            attributes:
              "$ref": "#/components/schemas/books"
            relationships:
              type: object
            links:
              type: object
          required:
          - id
          - type
          - attributes
        jsonapi:
          type: object
          properties:
            version:
              type: string
          required:
          - version
      required:
      - data
      - jsonapi
    report:
      type: object
      properties:
        title:
          type: string
        public:
          type: boolean
        state:
          type: string
        is_premium:
          type: boolean
        naics:
          type: integer
        industry_name:
          type: string
        sector_name:
          type: string
        industry_group:
          type: string
        id:
          type: string
        slug:
          type: string
        content:
          type: string
        created_at:
          type: integer
        owner_id:
          type: integer
      required:
      - title
      - public
      - state
      - is_premium
      - naics
      - industry_name
      - sector_name
      - industry_group
      - id
      - slug
      - content
      - created_at
      - owner_id
    organization:
      type: object
      properties:
        name:
          type: string
        id:
          type: integer
        api_token:
          type: string
        custom_watermark:
          type: string
        subscription_data:
          type: object
          properties:
            plan_name:
              type: string
            plan_api_enabled:
              type: boolean
            plan_advanced_reports:
              type: integer
            plan_free_reports:
              type: integer
            plan_chat_messages:
              type: integer
            credit_advanced_reports:
              type: integer
            credit_free_reports:
              type: integer
            credit_chat_messages:
              type: integer
            remaining_chat_messages:
              type: integer
            remaining_subscription_reports:
              type: integer
            remaining_advanced_reports:
              type: integer
            remaining_free_reports:
              type: integer
      required:
      - name
      - id
      - api_token
      - custom_watermark
      - subscription_data
    report_response:
      type: object
      properties:
        data:
          type: object
          properties:
            id:
              type: string
            type:
              type: string
            attributes:
              "$ref": "#/components/schemas/report"
            relationships:
              type: object
            links:
              type: object
          required:
          - id
          - type
          - attributes
        jsonapi:
          type: object
          properties:
            version:
              type: string
          required:
          - version
      required:
      - data
      - jsonapi
    reports_response:
      type: object
      properties:
        data:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
              type:
                type: string
              attributes:
                "$ref": "#/components/schemas/report"
              relationships:
                type: object
              links:
                type: object
            required:
            - id
            - type
            - attributes
        jsonapi:
          type: object
          properties:
            version:
              type: string
          required:
          - version
      required:
      - data
      - jsonapi
    organization_response:
      type: object
      properties:
        data:
          type: object
          properties:
            id:
              type: string
            type:
              type: string
            attributes:
              "$ref": "#/components/schemas/organization"
            relationships:
              type: object
            links:
              type: object
          required:
          - id
          - type
          - attributes
        jsonapi:
          type: object
          properties:
            version:
              type: string
          required:
          - version
      required:
      - data
      - jsonapi
    organizations_response:
      type: object
      properties:
        data:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
              type:
                type: string
              attributes:
                "$ref": "#/components/schemas/organization"
              relationships:
                type: object
              links:
                type: object
            required:
            - id
            - type
            - attributes
        jsonapi:
          type: object
          properties:
            version:
              type: string
          required:
          - version
      required:
      - data
      - jsonapi
    stats:
      type: object
      properties:
        accounts:
          type: integer
        avg_report_time:
          type: number
          format: float
        reports:
          type: integer
      required:
      - accounts
      - avg_report_time
      - reports
    stats_response:
      type: object
      properties:
        data:
          type: object
          properties:
            id:
              type: string
            type:
              type: string
            attributes:
              "$ref": "#/components/schemas/stats"
            relationships:
              type: object
            links:
              type: object
          required:
          - id
          - type
          - attributes
        jsonapi:
          type: object
          properties:
            version:
              type: string
          required:
          - version
      required:
      - data
      - jsonapi
    user:
      type: object
      properties:
        name:
          type: string
        email:
          type: string
        subscription_data:
          type: object
          properties:
            plan_name:
              type: string
            plan_api_enabled:
              type: boolean
            plan_advanced_reports:
              type: integer
            plan_free_reports:
              type: integer
            plan_chat_messages:
              type: integer
            credit_advanced_reports:
              type: integer
            credit_free_reports:
              type: integer
            credit_chat_messages:
              type: integer
            remaining_chat_messages:
              type: integer
            remaining_subscription_reports:
              type: integer
            remaining_advanced_reports:
              type: integer
            remaining_free_reports:
              type: integer
      required:
      - name
      - email
      - subscription_data
    user_response:
      type: object
      properties:
        data:
          type: object
          properties:
            id:
              type: string
            type:
              type: string
            attributes:
              "$ref": "#/components/schemas/user"
            relationships:
              type: object
            links:
              type: object
          required:
          - id
          - type
          - attributes
        jsonapi:
          type: object
          properties:
            version:
              type: string
          required:
          - version
      required:
      - data
      - jsonapi
servers:
- url: "{protocol}://{defaultHost}"
  variables:
    protocol:
      default: https
    defaultHost:
      default: api.venturusai.com
