{
  "openapi": "3.1.0",
  "info": {
    "title": "Email Warm-up API",
    "version": "0.1.0"
  },
  "paths": {
    "/healthz": {
      "get": {
        "summary": "Healthz",
        "operationId": "healthz_healthz_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {
                    "type": "string"
                  },
                  "type": "object",
                  "title": "Response Healthz Healthz Get"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/mailboxes": {
      "post": {
        "tags": [
          "mailboxes"
        ],
        "summary": "Create Mailbox",
        "operationId": "create_mailbox_api_v1_mailboxes_post",
        "security": [
          {
            "APIKeyHeader": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MailboxCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MailboxResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "mailboxes"
        ],
        "summary": "List Mailboxes",
        "operationId": "list_mailboxes_api_v1_mailboxes_get",
        "security": [
          {
            "APIKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/WarmupStatus"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Status"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 100,
              "minimum": 1,
              "default": 100,
              "title": "Limit"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0,
              "title": "Offset"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/MailboxResponse"
                  },
                  "title": "Response List Mailboxes Api V1 Mailboxes Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/mailboxes/{mailbox_id}": {
      "get": {
        "tags": [
          "mailboxes"
        ],
        "summary": "Get Mailbox",
        "operationId": "get_mailbox_api_v1_mailboxes__mailbox_id__get",
        "security": [
          {
            "APIKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "mailbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Mailbox Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MailboxResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "mailboxes"
        ],
        "summary": "Delete Mailbox",
        "operationId": "delete_mailbox_api_v1_mailboxes__mailbox_id__delete",
        "security": [
          {
            "APIKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "mailbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Mailbox Id"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/mailboxes/{mailbox_id}/status": {
      "patch": {
        "tags": [
          "mailboxes"
        ],
        "summary": "Update Mailbox Status",
        "operationId": "update_mailbox_status_api_v1_mailboxes__mailbox_id__status_patch",
        "security": [
          {
            "APIKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "mailbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Mailbox Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MailboxStatusUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MailboxResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/mailboxes/{mailbox_id}/credentials": {
      "patch": {
        "tags": [
          "mailboxes"
        ],
        "summary": "Update Mailbox Credentials",
        "operationId": "update_mailbox_credentials_api_v1_mailboxes__mailbox_id__credentials_patch",
        "security": [
          {
            "APIKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "mailbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Mailbox Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MailboxCredentialsUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MailboxResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/mailboxes/{mailbox_id}/summary": {
      "get": {
        "tags": [
          "mailboxes"
        ],
        "summary": "Get Mailbox Summary",
        "operationId": "get_mailbox_summary_api_v1_mailboxes__mailbox_id__summary_get",
        "security": [
          {
            "APIKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "mailbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Mailbox Id"
            }
          },
          {
            "name": "days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 90,
              "minimum": 1,
              "default": 7,
              "title": "Days"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MailboxSummaryResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/mailboxes/{mailbox_id}/logs": {
      "get": {
        "tags": [
          "mailboxes"
        ],
        "summary": "List Mailbox Logs",
        "operationId": "list_mailbox_logs_api_v1_mailboxes__mailbox_id__logs_get",
        "security": [
          {
            "APIKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "mailbox_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Mailbox Id"
            }
          },
          {
            "name": "action",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/LogAction"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Action"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 100,
              "minimum": 1,
              "default": 100,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WarmupLogResponse"
                  },
                  "title": "Response List Mailbox Logs Api V1 Mailboxes  Mailbox Id  Logs Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AuthType": {
        "type": "string",
        "enum": [
          "oauth2",
          "app_password"
        ],
        "title": "AuthType"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "LogAction": {
        "type": "string",
        "enum": [
          "send",
          "landed_inbox",
          "landed_spam",
          "moved_to_inbox",
          "replied",
          "bounce",
          "auth_failed"
        ],
        "title": "LogAction"
      },
      "MailboxCreate": {
        "properties": {
          "email_address": {
            "type": "string",
            "maxLength": 320,
            "pattern": "^[^@\\s]+@[^@\\s]+$",
            "title": "Email Address"
          },
          "provider_type": {
            "$ref": "#/components/schemas/ProviderType"
          },
          "auth_type": {
            "$ref": "#/components/schemas/AuthType"
          },
          "credentials": {
            "additionalProperties": true,
            "type": "object",
            "title": "Credentials"
          },
          "proxy_url": {
            "anyOf": [
              {
                "type": "string",
                "format": "password",
                "writeOnly": true
              },
              {
                "type": "null"
              }
            ],
            "title": "Proxy Url"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "email_address",
          "provider_type",
          "auth_type",
          "credentials"
        ],
        "title": "MailboxCreate"
      },
      "MailboxCredentialsUpdate": {
        "properties": {
          "credentials": {
            "additionalProperties": true,
            "type": "object",
            "minProperties": 1,
            "title": "Credentials"
          },
          "reactivate": {
            "type": "boolean",
            "title": "Reactivate",
            "default": true
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "credentials"
        ],
        "title": "MailboxCredentialsUpdate"
      },
      "MailboxResponse": {
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "title": "Id"
          },
          "email_address": {
            "type": "string",
            "title": "Email Address"
          },
          "provider_type": {
            "$ref": "#/components/schemas/ProviderType"
          },
          "auth_type": {
            "$ref": "#/components/schemas/AuthType"
          },
          "has_proxy": {
            "type": "boolean",
            "title": "Has Proxy"
          },
          "warmup_status": {
            "$ref": "#/components/schemas/WarmupStatus"
          },
          "current_day": {
            "type": "integer",
            "title": "Current Day"
          },
          "daily_limit": {
            "type": "integer",
            "title": "Daily Limit"
          },
          "reply_rate_target": {
            "type": "number",
            "title": "Reply Rate Target"
          },
          "health_score": {
            "type": "integer",
            "title": "Health Score"
          },
          "last_synced_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Synced At"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
          }
        },
        "type": "object",
        "required": [
          "id",
          "email_address",
          "provider_type",
          "auth_type",
          "has_proxy",
          "warmup_status",
          "current_day",
          "daily_limit",
          "reply_rate_target",
          "health_score",
          "last_synced_at",
          "created_at"
        ],
        "title": "MailboxResponse"
      },
      "MailboxStatusUpdate": {
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "active",
              "paused"
            ],
            "title": "Status"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "status"
        ],
        "title": "MailboxStatusUpdate"
      },
      "MailboxSummaryResponse": {
        "properties": {
          "mailbox_id": {
            "type": "string",
            "format": "uuid",
            "title": "Mailbox Id"
          },
          "window_days": {
            "type": "integer",
            "title": "Window Days"
          },
          "warmup_status": {
            "$ref": "#/components/schemas/WarmupStatus"
          },
          "current_day": {
            "type": "integer",
            "title": "Current Day"
          },
          "daily_limit": {
            "type": "integer",
            "title": "Daily Limit"
          },
          "health_score": {
            "type": "integer",
            "title": "Health Score"
          },
          "last_synced_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Synced At"
          },
          "sent_count": {
            "type": "integer",
            "title": "Sent Count"
          },
          "landed_inbox_count": {
            "type": "integer",
            "title": "Landed Inbox Count"
          },
          "landed_spam_count": {
            "type": "integer",
            "title": "Landed Spam Count"
          },
          "rescued_from_spam_count": {
            "type": "integer",
            "title": "Rescued From Spam Count"
          },
          "replied_count": {
            "type": "integer",
            "title": "Replied Count"
          },
          "bounce_count": {
            "type": "integer",
            "title": "Bounce Count"
          },
          "auth_failed_count": {
            "type": "integer",
            "title": "Auth Failed Count"
          },
          "inbox_rate": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Inbox Rate"
          }
        },
        "type": "object",
        "required": [
          "mailbox_id",
          "window_days",
          "warmup_status",
          "current_day",
          "daily_limit",
          "health_score",
          "last_synced_at",
          "sent_count",
          "landed_inbox_count",
          "landed_spam_count",
          "rescued_from_spam_count",
          "replied_count",
          "bounce_count",
          "auth_failed_count",
          "inbox_rate"
        ],
        "title": "MailboxSummaryResponse"
      },
      "ProviderType": {
        "type": "string",
        "enum": [
          "gmail_free",
          "outlook_free",
          "google_workspace",
          "m365",
          "custom_smtp"
        ],
        "title": "ProviderType"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          },
          "input": {
            "title": "Input"
          },
          "ctx": {
            "type": "object",
            "title": "Context"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "WarmupLogResponse": {
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "title": "Id"
          },
          "mailbox_id": {
            "type": "string",
            "format": "uuid",
            "title": "Mailbox Id"
          },
          "thread_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "title": "Thread Id"
          },
          "action": {
            "$ref": "#/components/schemas/LogAction"
          },
          "details": {
            "anyOf": [
              {
                "additionalProperties": {
                  "type": "string"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Details"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
          }
        },
        "type": "object",
        "required": [
          "id",
          "mailbox_id",
          "thread_id",
          "action",
          "details",
          "created_at"
        ],
        "title": "WarmupLogResponse"
      },
      "WarmupStatus": {
        "type": "string",
        "enum": [
          "active",
          "paused",
          "auth_error",
          "rate_limited"
        ],
        "title": "WarmupStatus"
      }
    },
    "securitySchemes": {
      "APIKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    }
  }
}
