{
  "openapi": "3.1.0",
  "info": {
    "title": "Bigdata Subscription API",
    "version": "1.0.0",
    "description": "Subscription quotas and usage for your organization."
  },
  "servers": [
    {
      "url": "https://api.bigdata.com/"
    }
  ],
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-KEY"
      }
    },
    "schemas": {
      "BadRequestError": {
        "properties": {
          "statusCode": {
            "type": "integer",
            "const": 400,
            "title": "Statuscode",
            "default": 400
          },
          "message": {
            "type": "string",
            "title": "Message"
          }
        },
        "type": "object",
        "required": [
          "message"
        ],
        "title": "BadRequestError",
        "description": "Bad Request Error",
        "example": {
          "message": "Bad Request Error",
          "statusCode": 400
        }
      },
      "Billing": {
        "properties": {
          "period": {
            "$ref": "#/components/schemas/Period",
            "description": "Billing period information"
          },
          "credit_usage": {
            "type": "number",
            "title": "Credit Usage",
            "description": "Current credits usage in cents"
          },
          "units": {
            "items": {
              "$ref": "#/components/schemas/CreditUnit"
            },
            "type": "array",
            "title": "Units",
            "description": "List of unit usage information for the billing period"
          }
        },
        "type": "object",
        "required": [
          "period",
          "credit_usage",
          "units"
        ],
        "title": "Billing"
      },
      "CreditUnit": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id",
            "description": "Unique identifier for the unit"
          },
          "display_name": {
            "type": "string",
            "title": "Display Name",
            "description": "Display Name of the unit"
          },
          "units_usage": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "number"
              }
            ],
            "title": "Units Usage",
            "description": "Usage of the unit in cents"
          },
          "units_price": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Units Price",
            "description": "Price of the unit in cents"
          }
        },
        "type": "object",
        "required": [
          "id",
          "display_name",
          "units_usage",
          "units_price"
        ],
        "title": "CreditUnit"
      },
      "Credits": {
        "properties": {
          "limit": {
            "type": "integer",
            "title": "Limit",
            "description": "Total credits limit in cents"
          },
          "usage": {
            "type": "integer",
            "title": "Usage",
            "description": "Current credits usage in cents"
          },
          "remaining": {
            "type": "integer",
            "title": "Remaining",
            "description": "Remaining credits or 'unlimited' for unlimited credits."
          }
        },
        "type": "object",
        "required": [
          "limit",
          "usage"
        ],
        "title": "Credits"
      },
      "InternalServerError": {
        "properties": {
          "statusCode": {
            "type": "integer",
            "const": 500,
            "title": "Statuscode",
            "default": 500
          },
          "message": {
            "type": "string",
            "title": "Message"
          }
        },
        "type": "object",
        "required": [
          "message"
        ],
        "title": "InternalServerError",
        "description": "Internal Server Error",
        "example": {
          "message": "Internal Server Error",
          "statusCode": 500
        }
      },
      "Period": {
        "properties": {
          "start": {
            "type": "string",
            "title": "Start",
            "description": "Start date of the billing period"
          },
          "end": {
            "type": "string",
            "title": "End",
            "description": "End date of the billing period"
          }
        },
        "type": "object",
        "required": [
          "start",
          "end"
        ],
        "title": "Period"
      },
      "QuotaUnit": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id",
            "description": "Unique identifier for the unit"
          },
          "display_name": {
            "type": "string",
            "title": "Display Name",
            "description": "Display Name of the unit"
          },
          "units_usage": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "number"
              }
            ],
            "title": "Units Usage",
            "description": "Usage of the unit in cents"
          },
          "units_limit": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "number"
              },
              {
                "type": "string",
                "const": "unlimited"
              }
            ],
            "title": "Units Limit",
            "description": "Limit of the unit in cents"
          }
        },
        "type": "object",
        "required": [
          "id",
          "display_name",
          "units_usage",
          "units_limit"
        ],
        "title": "QuotaUnit"
      },
      "SubscriptionCredits": {
        "properties": {
          "org_id": {
            "type": "string",
            "title": "Org Id",
            "description": "Your organization ID"
          },
          "subscription_type": {
            "type": "string",
            "const": "credits",
            "title": "Subscription Type",
            "description": "Type of subscription",
            "default": "credits"
          },
          "credits": {
            "$ref": "#/components/schemas/Credits",
            "description": "Credits information for the organization"
          },
          "billing": {
            "items": {
              "$ref": "#/components/schemas/Billing"
            },
            "type": "array",
            "title": "Billing",
            "description": "List of billing information for the organization"
          }
        },
        "type": "object",
        "required": [
          "org_id",
          "subscription_type",
          "credits",
          "billing"
        ],
        "title": "SubscriptionCredits",
        "description": "Response model for subscription credits information. All prices in CENTS."
      },
      "SubscriptionQuotas": {
        "properties": {
          "org_id": {
            "type": "string",
            "title": "Org Id",
            "description": "Organization ID"
          },
          "subscription_type": {
            "type": "string",
            "const": "quota",
            "title": "Subscription Type",
            "description": "Type of subscription",
            "default": "quota"
          },
          "quota_units": {
            "items": {
              "$ref": "#/components/schemas/QuotaUnit"
            },
            "type": "array",
            "title": "Quota Units",
            "description": "List of quota unit information for the organization"
          }
        },
        "type": "object",
        "required": [
          "org_id",
          "subscription_type",
          "quota_units"
        ],
        "title": "SubscriptionQuotas",
        "description": "Response model for subscription quota information. All prices in CENTS."
      }
    }
  },
  "security": [
    {
      "ApiKeyAuth": []
    }
  ],
  "paths": {
    "/v1/subscription/quotas": {
      "get": {
        "tags": [
          "Quotas"
        ],
        "summary": "Get Subscription Quotas",
        "description": "Returns the current subscription quotas and usage for the organization. For examples, see the [Monitor usage](/how-to-guides/monitor_usage) how-to guide.",
        "operationId": "get_subscription_quotas_v1_subscription_quotas_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/SubscriptionQuotas"
                    },
                    {
                      "$ref": "#/components/schemas/SubscriptionCredits"
                    }
                  ],
                  "title": "Response Get Subscription Quotas V1 Subscription Quotas Get"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestError"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InternalServerError"
                }
              }
            }
          }
        }
      }
    }
  }
}
