{
  "openapi": "3.1.0",
  "info": {
    "title": "tempmo API",
    "version": "1.0.0",
    "description": "Free, no-key API for receive-only temporary inboxes and email diagnostics. Agent-friendly: long-poll for new mail and get the one-time code / verification link extracted. Fair use: per-IP rate limits (HTTP 429 with retry_after_seconds). Mail is deleted 24h after arrival; anyone who knows an address can read it. Also available as a remote MCP server at https://tempmo.com/mcp. Optional: a tempmo key (Authorization: Bearer tm_…) unlocks claimed custom names only you can read, longer retention and one combined inbox (/api/me).",
    "contact": {
      "email": "contact@tempmo.com",
      "url": "https://tempmo.com/developers/"
    }
  },
  "servers": [
    {
      "url": "https://tempmo.com"
    }
  ],
  "paths": {
    "/api/address": {
      "post": {
        "operationId": "createInbox",
        "summary": "Create temporary inbox address(es)",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "local": {
                    "type": "string",
                    "description": "Claim a custom name (needs a key). Claimed names are private to the key."
                  },
                  "count": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 10
                  },
                  "prefix": {
                    "type": "string",
                    "description": "Creates prefix.<6 random chars> addresses."
                  },
                  "private": {
                    "type": "boolean",
                    "description": "Address on your private domain (owner key)."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "address": {
                      "type": "string"
                    },
                    "addresses": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "address",
                    "addresses"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/inbox/{address}": {
      "get": {
        "operationId": "listEmails",
        "summary": "List emails (newest first, max 50)",
        "parameters": [
          {
            "name": "address",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "k3x9q7m2ab@tempmo.com"
          }
        ],
        "responses": {
          "200": {
            "description": "Inbox",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "address": {
                      "type": "string"
                    },
                    "messages": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/MessageSummary"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/inbox/{address}/wait": {
      "get": {
        "operationId": "waitForEmail",
        "summary": "Long-poll until an email arrives",
        "description": "Returns the oldest email received after `after` (default 0 = any email in the inbox), waiting up to `timeout` seconds. Pass after=<previous received_at> to wait for the next one.",
        "parameters": [
          {
            "name": "address",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "k3x9q7m2ab@tempmo.com"
          },
          {
            "name": "timeout",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 50,
              "default": 30
            }
          },
          {
            "name": "after",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "description": "Millisecond timestamp (received_at)."
          }
        ],
        "responses": {
          "200": {
            "description": "Email or timeout",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "address": {
                      "type": "string"
                    },
                    "timed_out": {
                      "type": "boolean"
                    },
                    "message": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/Message"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/message/{id}": {
      "get": {
        "operationId": "readEmail",
        "summary": "Read one email with extracted code and links",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "address",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Email",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Message"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteEmail",
        "summary": "Delete one email",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "address",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted"
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/check": {
      "get": {
        "operationId": "checkEmail",
        "summary": "Is an email/domain disposable, free, role-based; does it have MX?",
        "parameters": [
          {
            "name": "email",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "domain",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Result (verdict: invalid | disposable | no_mx | role | free | ok)"
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/check/bulk": {
      "post": {
        "operationId": "checkEmailsBulk",
        "summary": "Check up to 20 emails",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "emails": {
                    "type": "array",
                    "maxItems": 20,
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "emails"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Array of results"
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/dns/{type}": {
      "get": {
        "operationId": "dnsLookup",
        "summary": "Email DNS: MX, SPF, DMARC or DKIM",
        "parameters": [
          {
            "name": "type",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "mx",
                "spf",
                "dmarc",
                "dkim"
              ]
            }
          },
          {
            "name": "domain",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "selector",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "DKIM only; omit to scan common selectors."
          }
        ],
        "responses": {
          "200": {
            "description": "Records, parsed fields and issues"
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/headers/analyze": {
      "post": {
        "operationId": "analyzeHeaders",
        "summary": "Analyze raw email headers",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "headers": {
                    "type": "string"
                  }
                },
                "required": [
                  "headers"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Hops, delays, SPF/DKIM/DMARC results, flags"
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/health": {
      "get": {
        "operationId": "health",
        "summary": "Service health",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/me": {
      "get": {
        "operationId": "me",
        "summary": "Your key: plan, claimed names, domains",
        "security": [
          {
            "tempmoKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Key info"
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/me/inbox": {
      "get": {
        "operationId": "myInbox",
        "summary": "Newest mail across every address you own",
        "security": [
          {
            "tempmoKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Messages (each with address)"
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/me/wait": {
      "get": {
        "operationId": "waitForMyEmail",
        "summary": "Long-poll for the next mail to any address you own",
        "security": [
          {
            "tempmoKey": []
          }
        ],
        "parameters": [
          {
            "name": "timeout",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 50
            }
          },
          {
            "name": "after",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Email or timeout"
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/claims/{address}": {
      "delete": {
        "operationId": "releaseName",
        "summary": "Release a claimed name (its mail is deleted)",
        "security": [
          {
            "tempmoKey": []
          }
        ],
        "parameters": [
          {
            "name": "address",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Released"
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "retry_after_seconds": {
            "type": "integer"
          }
        },
        "required": [
          "error"
        ]
      },
      "MessageSummary": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "from": {
            "$ref": "#/components/schemas/Sender"
          },
          "subject": {
            "type": "string"
          },
          "received_at": {
            "type": "integer"
          },
          "snippet": {
            "type": "string"
          }
        }
      },
      "Sender": {
        "type": "object",
        "properties": {
          "address": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        }
      },
      "Message": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "address": {
            "type": "string"
          },
          "from": {
            "$ref": "#/components/schemas/Sender"
          },
          "subject": {
            "type": "string"
          },
          "text": {
            "type": [
              "string",
              "null"
            ]
          },
          "html": {
            "type": [
              "string",
              "null"
            ]
          },
          "attachments": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "filename": {
                  "type": "string"
                },
                "mimeType": {
                  "type": "string"
                },
                "size": {
                  "type": "integer"
                }
              }
            }
          },
          "received_at": {
            "type": "integer"
          },
          "size": {
            "type": "integer"
          },
          "extracted": {
            "type": "object",
            "properties": {
              "code": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "codes": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "verification_link": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "links": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "securitySchemes": {
      "tempmoKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "Optional tempmo key (tm_…). Unlocks claimed custom names, private-domain addresses (owner keys) and /api/me endpoints."
      }
    }
  },
  "security": [
    {},
    {
      "tempmoKey": []
    }
  ]
}