{
  "basePath": "/v1",
  "consumes": [
    "application/json"
  ],
  "definitions": {
    "AccountResponse": {
      "properties": {
        "email": {
          "description": "email address",
          "type": "string"
        },
        "status": {
          "description": "account status",
          "type": "string"
        },
        "tos_agreed": {
          "description": "if the user has agreed to the TOS",
          "type": "boolean"
        }
      },
      "required": [
        "email",
        "status",
        "tos_agreed"
      ],
      "type": "object"
    },
    "ApiKey": {
      "properties": {
        "client_id": {
          "description": "Client id for the API key",
          "type": "string"
        },
        "client_secret": {
          "description": "Client secret for the API key",
          "type": "string"
        },
        "enabled": {
          "description": "If the api key is enabled",
          "type": "boolean"
        },
        "label": {
          "description": "Common name for an API Key",
          "type": "string"
        }
      },
      "required": [
        "client_id",
        "client_secret",
        "enabled",
        "label"
      ],
      "type": "object"
    },
    "ApiKeyResponse": {
      "$ref": "#/definitions/ApiKey"
    },
    "ApiKeysResponse": {
      "properties": {
        "keys": {
          "description": "The array of api keys",
          "items": {
            "$ref": "#/definitions/ApiKey"
          },
          "type": "array"
        }
      },
      "type": "object"
    },
    "Application": {
      "properties": {
        "app_url": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "image_url": {
          "type": "string"
        },
        "name": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "name",
        "description",
        "image_url",
        "app_url"
      ],
      "type": "object"
    },
    "ApplicationRequest": {
      "properties": {
        "app_url": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "image_url": {
          "type": "string"
        },
        "name": {
          "type": "string"
        }
      },
      "required": [
        "name",
        "description",
        "image_url",
        "app_url"
      ],
      "type": "object"
    },
    "ApplicationsResponse": {
      "properties": {
        "items": {
          "items": {
            "$ref": "#/definitions/Application"
          },
          "type": "array"
        },
        "meta_data": {
          "$ref": "#/definitions/ListMetaData"
        }
      },
      "type": "object"
    },
    "Error": {
      "properties": {
        "code": {
          "format": "int32",
          "type": "integer"
        },
        "fields": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "Event": {
      "additionalProperties": {
        "type": "string"
      },
      "description": "Event payload with metadata.",
      "properties": {
        "entity": {
          "description": "An identifier that specified where this event originated from. Typically this is a hostname, IP address, or an alias of the host that generated this event. \n",
          "type": "string"
        },
        "source": {
          "description": "This identifier helps to classify events of this type based of what generated them.\n",
          "type": "string"
        },
        "time": {
          "description": "Epoch-formatted time of event generation.\n",
          "type": "string"
        }
      },
      "type": "object"
    },
    "Events": {
      "items": {
        "$ref": "#/definitions/Event"
      },
      "type": "array"
    },
    "EventsReturn": {
      "properties": {
        "bytes": {
          "description": "Number of bytes received",
          "format": "int64",
          "type": "integer"
        },
        "count": {
          "description": "Number of events received",
          "format": "int64",
          "type": "integer"
        }
      },
      "type": "object"
    },
    "FilterKV": {
      "properties": {
        "name": {
          "default": "key",
          "type": "string"
        },
        "values": {
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "type": "object"
    },
    "ListMetaData": {
      "properties": {
        "cache": {
          "type": "string"
        },
        "count": {
          "format": "int32",
          "type": "integer"
        },
        "index": {
          "format": "int32",
          "type": "integer"
        },
        "total_count": {
          "format": "int32",
          "type": "integer"
        }
      },
      "type": "object"
    },
    "QueryInfo": {
      "properties": {
        "cache": {
          "format": "byte",
          "type": "string"
        },
        "context": {
          "$ref": "#/definitions/SearchContext",
          "type": "object"
        },
        "context_id": {
          "default": "_default",
          "type": "string"
        },
        "count": {
          "default": 10,
          "format": "int32",
          "type": "integer"
        },
        "index": {
          "default": 0,
          "format": "int32",
          "type": "integer"
        },
        "keywords": {
          "default": "",
          "type": "string"
        },
        "report": {
          "default": "",
          "type": "string"
        },
        "transform": {
          "default": "",
          "type": "string"
        }
      },
      "type": "object"
    },
    "QueryLogicInfoMetaData": {
      "properties": {
        "info_message": {
          "description": "Shows the user the backend logic to handle the search conditions; like expired search, cache and new search mismatch",
          "type": "string"
        }
      },
      "type": "object"
    },
    "QueryResponse": {
      "properties": {
        "events": {
          "items": {
            "$ref": "#/definitions/Event"
          },
          "type": "array"
        },
        "fields": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "logic_info": {
          "$ref": "#/definitions/QueryLogicInfoMetaData"
        },
        "meta_data": {
          "$ref": "#/definitions/ListMetaData"
        }
      },
      "type": "object"
    },
    "SearchContext": {
      "properties": {
        "entities_filter": {
          "$ref": "#/definitions/SimpleFilter",
          "type": "object"
        },
        "sourcetypes_filter": {
          "$ref": "#/definitions/SimpleFilter",
          "type": "object"
        },
        "time_range": {
          "$ref": "#/definitions/TimeRange",
          "type": "object"
        }
      },
      "type": "object"
    },
    "SimpleFilter": {
      "properties": {
        "exclude": {
          "items": {
            "$ref": "#/definitions/FilterKV"
          },
          "type": "array"
        },
        "include": {
          "items": {
            "$ref": "#/definitions/FilterKV"
          },
          "type": "array"
        }
      },
      "type": "object"
    },
    "SocialProvider": {
      "properties": {
        "authorize_url": {
          "description": "endpoint to authorize against",
          "type": "string"
        },
        "display_name": {
          "description": "displayable name for provider",
          "type": "string"
        },
        "id": {
          "description": "unique provider id",
          "type": "string"
        },
        "img_url": {
          "description": "url for provider image to display",
          "type": "string"
        }
      },
      "required": [
        "id",
        "img_url",
        "display_name",
        "authorize_url"
      ],
      "type": "object"
    },
    "Tenant": {
      "properties": {
        "id": {
          "description": "The tenant UUID",
          "maxLength": 1024,
          "minLength": 1,
          "type": "string"
        },
        "ingest_status": {
          "description": "The state of the tenants indexer",
          "type": "boolean"
        },
        "label": {
          "description": "The label for the tenant",
          "type": "string"
        },
        "search_status": {
          "description": "The state of the tenants search head",
          "type": "boolean"
        }
      },
      "required": [
        "id",
        "label",
        "ingest_status",
        "search_status"
      ],
      "type": "object"
    },
    "TimeRange": {
      "properties": {
        "earliest": {
          "default": "-1h",
          "type": "string"
        },
        "latest": {
          "default": "now",
          "type": "string"
        }
      },
      "type": "object"
    },
    "Token": {
      "properties": {
        "access_token": {
          "description": "access token for the user",
          "type": "string"
        },
        "expires_at": {
          "description": "time at which the token expires",
          "format": "int32",
          "type": "integer"
        },
        "refresh_token": {
          "description": "refresh token for the user",
          "type": "string"
        },
        "token_type": {
          "description": "type of token for the access token (one of bearer, basic)",
          "type": "string"
        }
      },
      "required": [
        "access_token",
        "expires_at",
        "token_type"
      ],
      "type": "object"
    }
  },
  "host": "api.logface.io",
  "info": {
    "description": "External Facing Developer API\n",
    "title": "FireFawkes Developer API",
    "version": "v1"
  },
  "paths": {
    "/account": {
      "get": {
        "description": "Retrieve an account",
        "responses": {
          "200": {
            "description": "Account retrieved",
            "schema": {
              "$ref": "#/definitions/AccountResponse"
            }
          },
          "default": {
            "description": "Unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        },
        "security": [
          {
            "basicAuth": []
          }
        ],
        "summary": "Accounts represent individuals",
        "tags": [
          "Identity"
        ]
      },
      "put": {
        "description": "Update the TOS boolean for an account",
        "parameters": [
          {
            "in": "body",
            "name": "body",
            "schema": {
              "properties": {
                "tos_agreed": {
                  "description": "whether the user has agreed to the TOS",
                  "type": "boolean"
                }
              },
              "type": "object"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "account updated",
            "schema": {
              "$ref": "#/definitions/AccountResponse"
            }
          },
          "default": {
            "description": "Unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        },
        "security": [
          {
            "basicAuth": []
          }
        ],
        "summary": "Set whether the TOS has been agreed to",
        "tags": [
          "Identity"
        ]
      }
    },
    "/account/apiKeys": {
      "get": {
        "description": "Retrieve the api keys for the current account",
        "responses": {
          "200": {
            "description": "API Keys retrieved",
            "schema": {
              "$ref": "#/definitions/ApiKeysResponse"
            }
          },
          "default": {
            "description": "Unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        },
        "security": [
          {
            "basicAuth": []
          }
        ],
        "summary": "Get API Keys",
        "tags": [
          "Identity"
        ]
      },
      "post": {
        "description": "Create a new API Key",
        "parameters": [
          {
            "in": "body",
            "name": "body",
            "schema": {
              "properties": {
                "label": {
                  "description": "plain name of api key",
                  "type": "string"
                }
              },
              "type": "object"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "API Key Created",
            "schema": {
              "$ref": "#/definitions/ApiKeyResponse"
            }
          },
          "default": {
            "description": "Unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        },
        "security": [
          {
            "basicAuth": []
          }
        ],
        "summary": "New API Key",
        "tags": [
          "Identity"
        ]
      }
    },
    "/account/apiKeys/{client_id}": {
      "delete": {
        "description": "Delete the API Key",
        "parameters": [
          {
            "description": "the client ID of the API Key to delete",
            "in": "path",
            "name": "client_id",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "API Keys Deleted"
          },
          "default": {
            "description": "Unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        },
        "security": [
          {
            "basicAuth": []
          }
        ],
        "summary": "Delete API Key",
        "tags": [
          "Identity"
        ]
      },
      "get": {
        "description": "Retrieve the api key for the current account, specified by ID",
        "parameters": [
          {
            "description": "the client ID to retrieve",
            "in": "path",
            "name": "client_id",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "API Keys retrieved",
            "schema": {
              "$ref": "#/definitions/ApiKeyResponse"
            }
          },
          "default": {
            "description": "Unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        },
        "security": [
          {
            "basicAuth": []
          }
        ],
        "summary": "Get API Key",
        "tags": [
          "Identity"
        ]
      },
      "put": {
        "description": "Enable/Disable the API Key",
        "parameters": [
          {
            "description": "the client ID of the API to update",
            "in": "path",
            "name": "client_id",
            "required": true,
            "type": "string"
          },
          {
            "in": "body",
            "name": "body",
            "schema": {
              "properties": {
                "enabled": {
                  "description": "If the api key is enabled",
                  "type": "boolean"
                },
                "label": {
                  "description": "plain name of api key",
                  "type": "string"
                }
              },
              "type": "object"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "API Key Updated",
            "schema": {
              "$ref": "#/definitions/ApiKeyResponse"
            }
          },
          "default": {
            "description": "Unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        },
        "security": [
          {
            "basicAuth": []
          }
        ],
        "summary": "Update the API Key",
        "tags": [
          "Identity"
        ]
      }
    },
    "/applications": {
      "get": {
        "description": "Find many applications",
        "parameters": [
          {
            "default": 0,
            "description": "Index of the first event in the set of returned results.  Negative index will count from the end of the results.",
            "format": "int32",
            "in": "query",
            "name": "index",
            "type": "integer"
          },
          {
            "default": 10,
            "description": "Number of events desired.  Will return fewer if there are fewer to return.",
            "format": "int32",
            "in": "query",
            "name": "count",
            "type": "integer"
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "items": {
                "$ref": "#/definitions/ApplicationsResponse"
              },
              "type": "array"
            }
          },
          "default": {
            "description": "Unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        },
        "summary": "Find applications",
        "tags": [
          "Applications"
        ]
      }
    },
    "/applications/{id}": {
      "get": {
        "description": "Find an existing application",
        "parameters": [
          {
            "description": "id of the of the application",
            "in": "path",
            "name": "id",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "$ref": "#/definitions/Application"
            }
          },
          "default": {
            "description": "Unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        },
        "summary": "Find an application",
        "tags": [
          "Applications"
        ]
      }
    },
    "/contexts": {
      "post": {
        "parameters": [
          {
            "in": "body",
            "name": "search_context",
            "required": true,
            "schema": {
              "$ref": "#/definitions/SearchContext"
            }
          },
          {
            "description": "ID of the tenant",
            "in": "header",
            "name": "tenantID",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "201": {
            "description": "Created Context",
            "schema": {
              "$ref": "#/definitions/SearchContext"
            }
          },
          "default": {
            "description": "Unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        },
        "summary": "Create a search context",
        "tags": [
          "Context"
        ]
      }
    },
    "/contexts/{id}": {
      "get": {
        "description": "This endpoint allows for retrieving events based on an SPL query.\nSPL Reference -- http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/WhatsInThisManual\n",
        "parameters": [
          {
            "default": "_default",
            "in": "path",
            "name": "id",
            "required": true,
            "type": "string"
          },
          {
            "description": "ID of the tenant",
            "in": "header",
            "name": "tenantID",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "List of events that matched",
            "schema": {
              "$ref": "#/definitions/SearchContext"
            }
          },
          "default": {
            "description": "Unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        },
        "summary": "Retrieve context",
        "tags": [
          "Context"
        ]
      }
    },
    "/events": {
      "get": {
        "description": "This endpoint allows for retrieving events based on an SPL query.\nSPL Reference -- http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/WhatsInThisManual\n",
        "parameters": [
          {
            "default": "_default",
            "in": "query",
            "name": "context_id",
            "type": "string"
          },
          {
            "default": "",
            "description": "Whitespace separated keywords",
            "in": "query",
            "name": "keywords",
            "type": "string"
          },
          {
            "default": "",
            "description": "event-by-event transformations",
            "in": "query",
            "name": "transform",
            "type": "string"
          },
          {
            "default": "",
            "description": "report aggregations",
            "in": "query",
            "name": "report",
            "type": "string"
          },
          {
            "description": "Contains the search jobID",
            "format": "byte",
            "in": "query",
            "name": "cache",
            "type": "string"
          },
          {
            "default": 10,
            "description": "Maximum number of entries to return. Will return fewer if there are fewer to return. Set value to -1 to get all available entries.",
            "format": "int32",
            "in": "query",
            "name": "count",
            "type": "integer"
          },
          {
            "default": 0,
            "description": "Index of first item to return.",
            "format": "int32",
            "in": "query",
            "name": "index",
            "type": "integer"
          }
        ],
        "responses": {
          "200": {
            "description": "List of events that matched",
            "schema": {
              "$ref": "#/definitions/QueryResponse"
            }
          },
          "default": {
            "description": "Unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        },
        "security": [
          {
            "basicAuth": []
          }
        ],
        "summary": "Retrieve matching events",
        "tags": [
          "Events"
        ]
      },
      "post": {
        "description": "This endpoint is used to send data in the form of 'events' to the log service.\nEvents have optional metadata.",
        "operationId": "events",
        "parameters": [
          {
            "in": "body",
            "name": "events",
            "required": true,
            "schema": {
              "$ref": "#/definitions/Events"
            }
          },
          {
            "default": "events",
            "in": "header",
            "name": "input",
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "Upon successful indexing of event.",
            "schema": {
              "$ref": "#/definitions/EventsReturn"
            }
          },
          "default": {
            "description": "Unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        },
        "security": [
          {
            "basicAuth": []
          }
        ],
        "summary": "Send events",
        "tags": [
          "Events"
        ]
      }
    },
    "/search": {
      "post": {
        "description": "This endpoint allows for retrieving events based on an SPL query.\nSPL Reference -- http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/WhatsInThisManual\n",
        "parameters": [
          {
            "in": "body",
            "name": "query",
            "required": true,
            "schema": {
              "$ref": "#/definitions/QueryInfo"
            }
          },
          {
            "description": "ID of the tenant",
            "in": "header",
            "name": "tenantID",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "List of events that matched",
            "schema": {
              "$ref": "#/definitions/QueryResponse"
            }
          },
          "default": {
            "description": "Unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        },
        "summary": "Retrieve matching events",
        "tags": [
          "Search"
        ]
      }
    },
    "/tenants": {
      "get": {
        "description": "Get all tenants for a user",
        "responses": {
          "200": {
            "description": "Tenants retrieved",
            "schema": {
              "items": {
                "$ref": "#/definitions/Tenant"
              },
              "type": "array"
            }
          },
          "default": {
            "description": "Unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        },
        "security": [
          {
            "basicAuth": []
          }
        ],
        "summary": "Get tenants",
        "tags": [
          "Identity"
        ]
      }
    }
  },
  "produces": [
    "application/json"
  ],
  "schemes": [
    "https"
  ],
  "securityDefinitions": {
    "basicAuth": {
      "description": "HTTP Basic Authentication. Use API Key ID as username and API Key Secret as password.",
      "type": "basic"
    }
  },
  "swagger": "2.0"
}