openapi: 3.0.2
info:
  title: Event & Records Connection API
  description: API powering the ingestion of Events and Records.
  version: 0.1.0
components:
  securitySchemes:
    appId:
      type: apiKey
      in: header
      name: X-Algolia-Application-Id
    apiKey:
      type: apiKey
      in: header
      name: X-Algolia-API-Key
  parameters:
    PathInPath:
      name: path
      in: path
      description: >-
        The path of the API endpoint to target, anything after the /1 needs to
        be specified.
      required: true
      schema:
        type: string
        example: /keys
    Parameters:
      name: parameters
      in: query
      description: Query parameters to be applied to the current query.
      schema:
        type: object
        additionalProperties: true
  schemas:
    ErrorBase:
      description: Error.
      type: object
      additionalProperties: true
      properties:
        message:
          type: string
          example: Invalid Application-Id or API-Key
    taskType:
      type: string
      description: The type of the task executed.
      enum:
        - csv
    method:
      type: string
      description: The HTTP method that will be used to fetch the URL.
      default: GET
      enum:
        - GET
        - POST
    authenticationType:
      type: string
      description: The type of authentication to use.
      enum:
        - basic
    productType:
      type: string
      description: The product to target.
      enum:
        - search
    operationType:
      type: string
      description: The type of operation to execute.
      enum:
        - replace
    task:
      type: object
      description: A task object.
      properties:
        id:
          type: string
          description: The id of the task.
          format: uuid
          example: e0f6db8a-24f5-4092-83a4-1b2c6cb6d809
        type:
          $ref: '#/components/schemas/taskType'
      required:
        - id
        - type
  responses:
    BadRequest:
      description: Bad request or request arguments.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBase'
    FeatureNotEnabled:
      description: This feature is not enabled on your Algolia account.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBase'
    MethodNotAllowed:
      description: Method not allowed with this API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBase'
    IndexNotFound:
      description: Index not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBase'
servers:
  - url: https://data.{region}.algolia.com
    variables:
      region:
        default: us
        enum:
          - us
          - de
security:
  - appId: []
    apiKey: []
tags:
  - name: jobs
    x-displayName: Jobs
    description: Manage jobs.
x-tagGroups:
  - name: General
    tags:
      - jobs
paths:
  /1{path}:
    get:
      operationId: get
      summary: Send requests to the Algolia REST API
      description: This method allow you to send requests to the Algolia REST API.
      parameters:
        - $ref: '#/components/parameters/PathInPath'
        - $ref: '#/components/parameters/Parameters'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/FeatureNotEnabled'
        '403':
          $ref: '#/components/responses/MethodNotAllowed'
        '404':
          $ref: '#/components/responses/IndexNotFound'
    post:
      operationId: post
      requestBody:
        description: The parameters to send with the custom request.
        content:
          application/json:
            schema:
              type: object
      summary: Send requests to the Algolia REST API
      description: This method allow you to send requests to the Algolia REST API.
      parameters:
        - $ref: '#/components/parameters/PathInPath'
        - $ref: '#/components/parameters/Parameters'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/FeatureNotEnabled'
        '403':
          $ref: '#/components/responses/MethodNotAllowed'
        '404':
          $ref: '#/components/responses/IndexNotFound'
    put:
      operationId: put
      requestBody:
        description: The parameters to send with the custom request.
        content:
          application/json:
            schema:
              type: object
      summary: Send requests to the Algolia REST API
      description: This method allow you to send requests to the Algolia REST API.
      parameters:
        - $ref: '#/components/parameters/PathInPath'
        - $ref: '#/components/parameters/Parameters'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/FeatureNotEnabled'
        '403':
          $ref: '#/components/responses/MethodNotAllowed'
        '404':
          $ref: '#/components/responses/IndexNotFound'
    delete:
      operationId: del
      summary: Send requests to the Algolia REST API
      description: This method allow you to send requests to the Algolia REST API.
      parameters:
        - $ref: '#/components/parameters/PathInPath'
        - $ref: '#/components/parameters/Parameters'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/FeatureNotEnabled'
        '403':
          $ref: '#/components/responses/MethodNotAllowed'
        '404':
          $ref: '#/components/responses/IndexNotFound'
  /1/ingest/url:
    post:
      tags:
        - jobs
      operationId: postIngestUrl
      summary: Create fetch URL job
      description: Add an ingestion job that will fetch data from an URL.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              title: postURLJob
              type: object
              description: Object containing a URL job.
              additionalProperties: false
              required:
                - type
                - input
                - target
              properties:
                type:
                  $ref: '#/components/schemas/taskType'
                uniqueIDColumn:
                  type: string
                  description: The name of the column that hold the unique identifier.
                  example: objectID
                input:
                  type: object
                  title: postURLJobInput
                  description: The input of the job.
                  additionalProperties: false
                  required:
                    - url
                  properties:
                    url:
                      type: string
                      description: The URL of the file to ingest.
                    method:
                      $ref: '#/components/schemas/method'
                    auth:
                      type: object
                      title: postURLJobAuth
                      description: >-
                        The authentication scheme for the URL that will be
                        fetched.
                      additionalProperties: false
                      required:
                        - type
                        - login
                        - password
                      properties:
                        type:
                          $ref: '#/components/schemas/authenticationType'
                        login:
                          type: string
                          description: The login to use for Basic Auth.
                          example: johndoe
                        password:
                          type: string
                          description: The password to use for Basic Auth.
                          example: mypassword
                target:
                  type: object
                  title: postURLJobTarget
                  description: The target of the job.
                  additionalProperties: false
                  required:
                    - type
                    - indexName
                    - operation
                  properties:
                    type:
                      $ref: '#/components/schemas/productType'
                    indexName:
                      type: string
                      description: The index name of the product.
                      example: my_index_name
                    operation:
                      $ref: '#/components/schemas/operationType'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                title: postIngestUrlResponse
                type: object
                additionalProperties: false
                required:
                  - task
                properties:
                  task:
                    $ref: '#/components/schemas/task'
        '400':
          $ref: '#/components/responses/BadRequest'
