{
  "openapi": "3.1.0",
  "info": {
    "title": "Cloudidr Authentication API",
    "description": "API for authentication and access token management.",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://public-api.cloudidr.com",
      "description": "Production server"
    }
  ],
  "paths": {
    "/external/api/v1/sign-in": {
      "post": {
        "summary": "Sign In",
        "description": "Authenticate and obtain an access token (JWT) for API requests. The access token must be included in the Authorization header as 'Bearer <token>' for all subsequent API calls.",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "username",
                  "password"
                ],
                "properties": {
                  "username": {
                    "type": "string",
                    "description": "User's email or username"
                  },
                  "password": {
                    "type": "string",
                    "description": "User's password"
                  }
                }
              },
              "example": {
                "username": "user@example.com",
                "password": "your_password"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successfully authenticated - Returns access token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "access_token": {
                      "type": "string",
                      "description": "JWT access token to be used in Authorization header"
                    },
                    "token_type": {
                      "type": "string",
                      "description": "Token type (always 'Bearer')"
                    },
                    "expires_in": {
                      "type": "integer",
                      "description": "Token expiration time in seconds"
                    }
                  }
                },
                "example": {
                  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
                  "token_type": "Bearer",
                  "expires_in": 3600
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - Missing or invalid credentials",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "400",
                    "message": "Bad Request",
                    "details": {
                      "timestamp": "2025-03-04T17:01:01",
                      "description": "Username and password are required"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Invalid credentials",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "401",
                    "message": "Unauthorized",
                    "details": {
                      "timestamp": "2025-03-04T17:01:01",
                      "description": "Invalid username or password"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - Unexpected error occurred",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "500",
                    "message": "Internal Server Error",
                    "details": {
                      "timestamp": "2025-03-04T17:17:08",
                      "description": "Unexpected error. Our team is working on it"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/external/api/v1/my-linked-accounts": {
      "get": {
        "summary": "Describe Linked Accounts",
        "description": "Retrieve a list of all cloud provider accounts linked to the authenticated user.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successfully retrieved linked accounts",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object"
                  }
                },
                "example": [
                  {
                    "accountId": "123456789012",
                    "accountName": "Production AWS",
                    "provider": "AWS",
                    "status": "active",
                    "linkedAt": "2024-01-15T10:30:00Z"
                  },
                  {
                    "accountId": "987654321098",
                    "accountName": "Development AWS",
                    "provider": "AWS",
                    "status": "active",
                    "linkedAt": "2024-02-20T14:45:00Z"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "Unauthorized - Unable to process access token",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "401",
                    "message": "Unauthorized",
                    "details": {
                      "timestamp": "2025-03-04T17:01:01",
                      "description": "Unable to process access token"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - Unexpected error occurred",
            "content": {
              "application/json": {
                "example": {
                  "error": {
                    "code": "500",
                    "message": "Internal Server Error",
                    "details": {
                      "timestamp": "2025-03-04T17:17:08",
                      "description": "Unexpected error. Our team is working on it"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    }
  }
}