{
  "openapi": "3.1.0",
  "info": {
    "title": "dazou temporary email API",
    "version": "1.0.0",
    "description": "Disposable inboxes on dazou.top / dazou.xyz. Create an address, keep the token, read incoming mail. Full guide: https://dazou.top/llms.txt"
  },
  "servers": [
    {
      "url": "https://dazou.top"
    }
  ],
  "paths": {
    "/api/new": {
      "get": {
        "operationId": "createInbox",
        "summary": "Create a temporary inbox (returns address + secret token)",
        "parameters": [
          {
            "name": "domain",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "dazou.top",
                "dazou.xyz",
                "random"
              ]
            }
          },
          {
            "name": "name",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Custom local part (3-40 chars a-z0-9._-)"
          },
          {
            "name": "ttl",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Lifetime in hours (default 168, max 720); 30m/12h/3d accepted"
          },
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "text"
              ]
            },
            "description": "text = compact plain-text response"
          }
        ],
        "responses": {
          "201": {
            "description": "Inbox created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "address": {
                      "type": "string"
                    },
                    "token": {
                      "type": "string"
                    },
                    "domain": {
                      "type": "string"
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "expires_at": {
                      "type": "string"
                    },
                    "inbox_url": {
                      "type": "string"
                    },
                    "wait_url": {
                      "type": "string"
                    },
                    "latest_url": {
                      "type": "string"
                    },
                    "web_url": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "address_taken"
          },
          "429": {
            "description": "rate_limited"
          }
        }
      }
    },
    "/api/inbox/{token}": {
      "get": {
        "operationId": "listMessages",
        "summary": "Inbox info and message list (newest first)",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Inbox access token returned by /api/new"
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "since",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "text"
              ]
            },
            "description": "text = compact plain-text response"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "401": {
            "description": "invalid_token"
          },
          "410": {
            "description": "inbox_expired"
          }
        }
      },
      "delete": {
        "operationId": "deleteInbox",
        "summary": "Delete the inbox and all messages",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Inbox access token returned by /api/new"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/inbox/{token}/wait": {
      "get": {
        "operationId": "waitForMessages",
        "summary": "Long-poll until unseen messages arrive (returns full messages and marks them seen)",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Inbox access token returned by /api/new"
          },
          {
            "name": "timeout",
            "in": "query",
            "schema": {
              "type": "integer",
              "maximum": 60
            },
            "description": "Seconds to wait (default 30)"
          },
          {
            "name": "since",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Return messages received after this ISO time / epoch ms instead of unseen ones"
          },
          {
            "name": "html",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1"
              ]
            },
            "description": "0 to omit the HTML body"
          },
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "text"
              ]
            },
            "description": "text = compact plain-text response"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "timed_out": {
                      "type": "boolean"
                    },
                    "next_since": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "messages": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "received_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "sent_at": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "from": {
                            "type": "object",
                            "properties": {
                              "address": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            }
                          },
                          "to": {
                            "type": "string"
                          },
                          "subject": {
                            "type": "string"
                          },
                          "code": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Best-guess verification / one-time code"
                          },
                          "codes": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "text": {
                            "type": "string"
                          },
                          "html": {
                            "type": "string"
                          },
                          "links": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "verification_links": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "attachments": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "filename": {
                                  "type": "string"
                                },
                                "mime_type": {
                                  "type": "string"
                                },
                                "size": {
                                  "type": "integer"
                                },
                                "content_id": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "inline": {
                                  "type": "boolean"
                                },
                                "available": {
                                  "type": "boolean"
                                },
                                "url": {
                                  "type": "string"
                                }
                              }
                            }
                          },
                          "raw_url": {
                            "type": "string"
                          },
                          "attachment_count": {
                            "type": "integer"
                          },
                          "seen": {
                            "type": "boolean"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/inbox/{token}/latest": {
      "get": {
        "operationId": "latestMessage",
        "summary": "Most recent message (full)",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Inbox access token returned by /api/new"
          },
          {
            "name": "html",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1"
              ]
            },
            "description": "0 to omit the HTML body"
          },
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "text"
              ]
            },
            "description": "text = compact plain-text response"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "received_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "sent_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "from": {
                      "type": "object",
                      "properties": {
                        "address": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      }
                    },
                    "to": {
                      "type": "string"
                    },
                    "subject": {
                      "type": "string"
                    },
                    "code": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Best-guess verification / one-time code"
                    },
                    "codes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "text": {
                      "type": "string"
                    },
                    "html": {
                      "type": "string"
                    },
                    "links": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "verification_links": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "attachments": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "filename": {
                            "type": "string"
                          },
                          "mime_type": {
                            "type": "string"
                          },
                          "size": {
                            "type": "integer"
                          },
                          "content_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "inline": {
                            "type": "boolean"
                          },
                          "available": {
                            "type": "boolean"
                          },
                          "url": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "raw_url": {
                      "type": "string"
                    },
                    "attachment_count": {
                      "type": "integer"
                    },
                    "seen": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "no_messages"
          }
        }
      }
    },
    "/api/inbox/{token}/messages/{id}": {
      "get": {
        "operationId": "getMessage",
        "summary": "Full message",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Inbox access token returned by /api/new"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "html",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1"
              ]
            },
            "description": "0 to omit the HTML body"
          },
          {
            "name": "headers",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1"
              ]
            }
          },
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "text"
              ]
            },
            "description": "text = compact plain-text response"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "received_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "sent_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "from": {
                      "type": "object",
                      "properties": {
                        "address": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      }
                    },
                    "to": {
                      "type": "string"
                    },
                    "subject": {
                      "type": "string"
                    },
                    "code": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Best-guess verification / one-time code"
                    },
                    "codes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "text": {
                      "type": "string"
                    },
                    "html": {
                      "type": "string"
                    },
                    "links": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "verification_links": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "attachments": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "filename": {
                            "type": "string"
                          },
                          "mime_type": {
                            "type": "string"
                          },
                          "size": {
                            "type": "integer"
                          },
                          "content_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "inline": {
                            "type": "boolean"
                          },
                          "available": {
                            "type": "boolean"
                          },
                          "url": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "raw_url": {
                      "type": "string"
                    },
                    "attachment_count": {
                      "type": "integer"
                    },
                    "seen": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "message_not_found"
          }
        }
      },
      "delete": {
        "operationId": "deleteMessage",
        "summary": "Delete a message",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Inbox access token returned by /api/new"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/inbox/{token}/messages/{id}/raw": {
      "get": {
        "operationId": "getRawMessage",
        "summary": "Raw RFC 822 source (.eml)",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Inbox access token returned by /api/new"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "message/rfc822"
          }
        }
      }
    },
    "/api/inbox/{token}/messages/{id}/attachments/{attachment_id}": {
      "get": {
        "operationId": "getAttachment",
        "summary": "Download an attachment",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Inbox access token returned by /api/new"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "attachment_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "File content"
          }
        }
      }
    },
    "/api/inbox/{token}/extend": {
      "post": {
        "operationId": "extendInbox",
        "summary": "Set expiry to now + ttl hours",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Inbox access token returned by /api/new"
          },
          {
            "name": "ttl",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/domains": {
      "get": {
        "operationId": "listDomains",
        "summary": "Available domains and limits",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  }
}