{
  "openapi": "3.1.0",
  "info": {
    "title": "ClassroomIO Public API",
    "version": "1.0.0",
    "description": "Public API for managing organizations, audience members, and courses in ClassroomIO."
  },
  "servers": [
    {
      "url": "https://api.classroomio.com",
      "description": "Production environment"
    },
    {
      "url": "http://localhost:3002",
      "description": "Development environment"
    }
  ],
  "paths": {
    "/public-api/v1/audience": {
      "get": {
        "operationId": "getPublic-apiV1Audience",
        "description": "List audience members for the authenticated organization",
        "tags": [
          "Public API Audience"
        ],
        "responses": {
          "200": {
            "description": "Audience members returned successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "pagination": {
                      "type": "object"
                    },
                    "query": {
                      "type": "object"
                    }
                  },
                  "required": [
                    "success",
                    "data",
                    "pagination",
                    "query"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "page",
            "schema": {
              "default": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 20,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "in": "query",
            "name": "search",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "sortBy",
            "schema": {
              "default": "createdAt",
              "type": "string",
              "enum": [
                "createdAt",
                "name",
                "email"
              ]
            }
          },
          {
            "in": "query",
            "name": "sortOrder",
            "schema": {
              "default": "desc",
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            }
          }
        ]
      },
      "post": {
        "operationId": "postPublic-apiV1Audience",
        "description": "Create an audience member invitation for the authenticated organization",
        "tags": [
          "Public API Audience"
        ],
        "responses": {
          "201": {
            "description": "Audience member created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request body"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email",
                    "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                  },
                  "courseIds": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    }
                  },
                  "sendEmail": {
                    "default": true,
                    "type": "boolean"
                  }
                },
                "required": [
                  "email"
                ]
              }
            }
          }
        }
      }
    },
    "/public-api/v1/audience/assign-courses": {
      "post": {
        "operationId": "postPublic-apiV1AudienceAssign-courses",
        "description": "Assign one or more audience members to one or more courses",
        "tags": [
          "Public API Audience"
        ],
        "responses": {
          "200": {
            "description": "Audience members assigned to courses successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request body"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "profileIds": {
                    "minItems": 1,
                    "maxItems": 500,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    }
                  },
                  "courseIds": {
                    "minItems": 1,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    }
                  },
                  "sendEmail": {
                    "default": true,
                    "type": "boolean"
                  }
                },
                "required": [
                  "profileIds",
                  "courseIds"
                ]
              }
            }
          }
        }
      }
    },
    "/public-api/v1/audience/{memberId}": {
      "get": {
        "operationId": "getPublic-apiV1Audience:memberId",
        "description": "Get a single audience member by id",
        "tags": [
          "Public API Audience"
        ],
        "responses": {
          "200": {
            "description": "Audience member returned successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Audience member not found"
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "memberId",
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            },
            "required": true
          }
        ]
      },
      "delete": {
        "operationId": "deletePublic-apiV1Audience:memberId",
        "description": "Remove an audience member by id",
        "tags": [
          "Public API Audience"
        ],
        "responses": {
          "200": {
            "description": "Audience member removed successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Audience member not found"
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "memberId",
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            },
            "required": true
          }
        ]
      },
      "put": {
        "operationId": "putPublic-apiV1Audience:memberId",
        "description": "Update a pending audience member email address",
        "tags": [
          "Public API Audience"
        ],
        "responses": {
          "200": {
            "description": "Audience member updated successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request body"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Audience member not found"
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "memberId",
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email",
                    "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                  },
                  "sendEmail": {
                    "default": true,
                    "type": "boolean"
                  }
                },
                "required": [
                  "email"
                ]
              }
            }
          }
        }
      }
    },
    "/public-api/v1/courses": {
      "get": {
        "operationId": "getPublic-apiV1Courses",
        "description": "List courses for the authenticated organization",
        "tags": [
          "Public API Courses"
        ],
        "responses": {
          "200": {
            "description": "Courses returned successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "tags",
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/public-api/v1/courses/{courseId}/students": {
      "get": {
        "operationId": "getPublic-apiV1Courses:courseIdStudents",
        "description": "List enrolled students for a course",
        "tags": [
          "Public API Courses"
        ],
        "responses": {
          "200": {
            "description": "Course students returned successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Course not found"
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "courseId",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "required": true
          }
        ]
      }
    },
    "/public-api/v1/courses/{courseId}/export": {
      "get": {
        "operationId": "getPublic-apiV1Courses:courseIdExport",
        "description": "Export a course structure snapshot",
        "tags": [
          "Public API Courses"
        ],
        "responses": {
          "200": {
            "description": "Course export returned successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Course not found"
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "courseId",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "required": true
          }
        ]
      }
    },
    "/public-api/v1/courses/{courseId}": {
      "get": {
        "operationId": "getPublic-apiV1Courses:courseId",
        "description": "Get a single course by id",
        "tags": [
          "Public API Courses"
        ],
        "responses": {
          "200": {
            "description": "Course returned successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object"
                    }
                  },
                  "required": [
                    "success",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Course not found"
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "courseId",
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "required": true
          }
        ]
      }
    }
  },
  "components": {}
}