{
  "openapi": "3.1.0",
  "info": {
    "title": "Cledara API",
    "version": "v1",
    "description": "\nThe Cledara API gives you programmatic access to your Cledara workspace — applications, transactions, and more coming soon.\n\n## Authentication\n\nAll endpoints require an API key passed as a Bearer token: `Authorization: Bearer <your-api-key>`\n\nAPI keys are managed in the Cledara web app under **Profile → API Keys**. Each key grants the same level of access as the user who created it.\n\n## Rate limits\n\nRequests are limited to **120 per minute per API key**. Every response includes the following headers:\n\n| Header | Description |\n|--------|-------------|\n| `X-RateLimit-Limit` | Maximum requests allowed in the current window |\n| `X-RateLimit-Remaining` | Requests remaining in the current window |\n| `X-RateLimit-Reset` | Unix timestamp when the window resets |\n\nWhen the limit is exceeded the API responds with `429 Too Many Requests` and an additional `Retry-After` header indicating how many seconds to wait before retrying.\n"
  },
  "servers": [
    {
      "url": "https://api.cledara.com"
    }
  ],
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "API key issued from the Cledara Web Application"
      }
    },
    "schemas": {
      "Application": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Application unique identifier"
          },
          "name": {
            "type": "string",
            "description": "Application name"
          },
          "status": {
            "type": "string",
            "enum": ["pending", "requested", "active", "disabled", "inactive"],
            "description": "Application status"
          },
          "budget": {
            "$ref": "#/components/schemas/Budget"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "ISO 8601 timestamp of application creation"
          },
          "owner": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "description": "Member unique identifier"
              },
              "name": {
                "type": "string",
                "description": "Member name"
              }
            },
            "required": ["id", "name"],
            "description": "Application owner"
          },
          "nextRenewalDate": {
            "type": ["string", "null"],
            "format": "date",
            "description": "ISO 8601 date of next renewal date"
          },
          "balance": {
            "type": ["number", "null"],
            "description": "Application balance"
          },
          "nextPayment": {
            "type": ["object", "null"],
            "properties": {
              "date": {
                "type": "string",
                "format": "date",
                "description": "ISO 8601 date of next payment"
              },
              "amount": {
                "type": "number",
                "description": "Expected amount of the next payment"
              }
            },
            "required": ["date", "amount"],
            "description": "Expected next payment, based on last payment and budget periodicity"
          }
        },
        "required": [
          "id",
          "name",
          "status",
          "budget",
          "createdAt",
          "owner",
          "nextRenewalDate",
          "balance",
          "nextPayment"
        ]
      },
      "Budget": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": ["soft", "fixed", "noBudget"],
            "description": "Budget type"
          },
          "limit": {
            "type": ["number", "null"],
            "description": "Budget limit amount for the given period"
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency code"
          },
          "periodicity": {
            "type": ["string", "null"],
            "enum": ["week", "month", "quarter", "year", null],
            "description": "Periodicity of the budget"
          }
        },
        "required": ["type", "limit", "currency", "periodicity"]
      }
    },
    "parameters": {}
  },
  "paths": {
    "/v0/applications": {
      "get": {
        "summary": "List applications in the workspace",
        "tags": ["Applications"],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Application"
                  },
                  "description": "List of applications"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "403": {
            "description": "Insufficient privileges for this account"
          }
        }
      }
    }
  },
  "webhooks": {}
}
