{
  "openapi": "3.0.3",
  "info": {
    "title": "Obbo Chama Mail API",
    "version": "1.1.0",
    "description": "Powered by Obbo Chama. Each API user can access only their own API-created inboxes. Limits: 120 requests and 20 creates per minute per API user."
  },
  "servers": [
    {
      "url": "/api/v1",
      "description": "Change prefix if installed under a subfolder."
    }
  ],
  "security": [
    {
      "BearerKey": []
    }
  ],
  "components": {
    "securitySchemes": {
      "BearerKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "im_ + 64 hex characters"
      }
    }
  },
  "paths": {
    "/domains": {
      "get": {
        "summary": "List domains",
        "responses": {
          "200": {
            "description": "Success"
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Invalid or disabled API key"
          },
          "404": {
            "description": "API inbox or message not found"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      }
    },
    "/mailboxes": {
      "get": {
        "summary": "Inbox information",
        "parameters": [
          {
            "name": "email",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "email"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Invalid or disabled API key"
          },
          "404": {
            "description": "API inbox or message not found"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      },
      "post": {
        "summary": "Create an inbox",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string"
                  },
                  "domain": {
                    "type": "string"
                  },
                  "username": {
                    "type": "string"
                  },
                  "password": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success"
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Invalid or disabled API key"
          },
          "404": {
            "description": "API inbox or message not found"
          },
          "429": {
            "description": "Rate limited"
          },
          "201": {
            "description": "Created; password returned once"
          },
          "409": {
            "description": "Address already exists"
          }
        }
      },
      "delete": {
        "summary": "Delete API inbox",
        "parameters": [
          {
            "name": "email",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "email"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Invalid or disabled API key"
          },
          "404": {
            "description": "API inbox or message not found"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      }
    },
    "/messages": {
      "get": {
        "summary": "List inbox messages",
        "parameters": [
          {
            "name": "email",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "email"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Invalid or disabled API key"
          },
          "404": {
            "description": "API inbox or message not found"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      }
    },
    "/messages/{id}": {
      "get": {
        "summary": "Read text and HTML message",
        "parameters": [
          {
            "name": "email",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "email"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Invalid or disabled API key"
          },
          "404": {
            "description": "API inbox or message not found"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      },
      "delete": {
        "summary": "Delete message",
        "parameters": [
          {
            "name": "email",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "email"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Invalid or disabled API key"
          },
          "404": {
            "description": "API inbox or message not found"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      }
    }
  }
}