{
  "openapi": "3.0.3",
  "info": {
    "title": "Ravi API",
    "version": "1.0.0",
    "description": "Identity provider for AI agents \u2014 provisioned phone numbers, email addresses, TOTP, OTP extraction, and E2E-encrypted passwords and secrets."
  },
  "paths": {
    "/api/email-attachments/presign/": {
      "post": {
        "operationId": "email_attachments_presign_create",
        "description": "Request a presigned PUT URL for uploading an attachment directly to R2.\n\nFlow:\n1. Client POSTs filename, content_type, size\n2. Server validates extension, content type, and size\n3. Server creates an EmailAttachment record (email=None, pending)\n4. Server returns presigned PUT URL + attachment UUID\n5. Client uploads file directly to R2 via the presigned URL\n6. Client includes attachment UUID(s) in compose/reply request",
        "tags": [
          "Attachments"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PresignRequestRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/PresignRequestRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PresignRequestRequest"
              }
            }
          },
          "required": true
        },
        "security": [
          {
            "identityKeyAuth": []
          },
          {
            "managementKeyAuth": []
          },
          {
            "jwtAuth": []
          },
          {
            "cookieAuth": []
          },
          {
            "basicAuth": []
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PresignResponse"
                }
              }
            },
            "description": ""
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "PresignRequestRequest": {
        "type": "object",
        "properties": {
          "filename": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "content_type": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "size": {
            "type": "integer",
            "minimum": 1
          }
        },
        "required": [
          "content_type",
          "filename",
          "size"
        ]
      },
      "PresignResponse": {
        "type": "object",
        "properties": {
          "uuid": {
            "type": "string",
            "format": "uuid"
          },
          "upload_url": {
            "type": "string",
            "format": "uri"
          },
          "storage_key": {
            "type": "string"
          }
        },
        "required": [
          "storage_key",
          "upload_url",
          "uuid"
        ]
      }
    }
  }
}
