{
  "openapi": "3.1.0",
  "info": {
    "title": "VANITY API",
    "version": "0.1.0",
    "description": "Public metadata and owner-scoped jobs. Generate keys locally; never send private keys. Prices: 4/5/6 = 1/5/10 USDC or SOL equivalent. Managed leases expire after 120 seconds; renew every 30 seconds."
  },
  "servers": [
    {
      "url": "https://vanitywallets.fun"
    }
  ],
  "components": {
    "securitySchemes": {
      "walletSession": {
        "type": "http",
        "scheme": "bearer",
        "description": "24-hour token from a locally signed wallet challenge"
      }
    },
    "schemas": {
      "Pattern": {
        "type": "object",
        "required": [
          "prefix",
          "suffix"
        ],
        "properties": {
          "prefix": {
            "type": "string",
            "maxLength": 6
          },
          "suffix": {
            "type": "string",
            "maxLength": 6
          },
          "ignoreCase": {
            "type": "boolean",
            "default": false
          },
          "creditId": {
            "type": "string",
            "maxLength": 64
          }
        }
      },
      "JobProgress": {
        "type": "object",
        "required": [
          "id"
        ],
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64
          },
          "attempts": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "elapsedMs": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        }
      },
      "ManagedJob": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "nonce": {
            "type": "string"
          },
          "prefix": {
            "type": "string"
          },
          "suffix": {
            "type": "string"
          },
          "mode": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "ignoreCase": {
            "type": "boolean"
          },
          "address": {
            "type": [
              "string",
              "null"
            ]
          },
          "runnerId": {
            "type": [
              "string",
              "null"
            ]
          },
          "attempts": {
            "type": "integer"
          },
          "elapsedMs": {
            "type": "integer"
          },
          "createdAt": {
            "type": "integer"
          },
          "updatedAt": {
            "type": "integer"
          },
          "leaseExpires": {
            "type": "integer"
          },
          "expires": {
            "type": "integer"
          }
        }
      }
    }
  },
  "paths": {
    "/api/auth/challenge": {
      "post": {
        "summary": "Request wallet ownership challenge",
        "responses": {
          "200": {
            "description": "Success"
          },
          "400": {
            "description": "Invalid request"
          },
          "403": {
            "description": "Authentication or access required"
          },
          "404": {
            "description": "Owner resource not found"
          },
          "409": {
            "description": "Conflict or unavailable reservation"
          },
          "429": {
            "description": "Rate limit"
          },
          "503": {
            "description": "Service unavailable"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "owner"
                ],
                "properties": {
                  "owner": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/auth/verify": {
      "post": {
        "summary": "Verify locally signed challenge and optionally return agent bearer token",
        "responses": {
          "200": {
            "description": "Success"
          },
          "400": {
            "description": "Invalid request"
          },
          "403": {
            "description": "Authentication or access required"
          },
          "404": {
            "description": "Owner resource not found"
          },
          "409": {
            "description": "Conflict or unavailable reservation"
          },
          "429": {
            "description": "Rate limit"
          },
          "503": {
            "description": "Service unavailable"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "id",
                  "signature"
                ],
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "signature": {
                    "type": "string"
                  },
                  "client": {
                    "type": "string",
                    "enum": [
                      "agent"
                    ]
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/auth/logout": {
      "post": {
        "summary": "Revoke current session",
        "responses": {
          "200": {
            "description": "Success"
          },
          "400": {
            "description": "Invalid request"
          },
          "403": {
            "description": "Authentication or access required"
          },
          "404": {
            "description": "Owner resource not found"
          },
          "409": {
            "description": "Conflict or unavailable reservation"
          },
          "429": {
            "description": "Rate limit"
          },
          "503": {
            "description": "Service unavailable"
          }
        },
        "security": [
          {
            "walletSession": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [],
                "properties": {}
              }
            }
          }
        }
      }
    },
    "/api/access": {
      "get": {
        "summary": "Read holder access, daily allowance and unused credits",
        "responses": {
          "200": {
            "description": "Success"
          },
          "400": {
            "description": "Invalid request"
          },
          "403": {
            "description": "Authentication or access required"
          },
          "404": {
            "description": "Owner resource not found"
          },
          "409": {
            "description": "Conflict or unavailable reservation"
          },
          "429": {
            "description": "Rate limit"
          },
          "503": {
            "description": "Service unavailable"
          }
        },
        "security": [
          {
            "walletSession": []
          }
        ]
      }
    },
    "/api/config": {
      "get": {
        "summary": "Read public prices, mint, treasury and payment status",
        "responses": {
          "200": {
            "description": "Success"
          },
          "400": {
            "description": "Invalid request"
          },
          "403": {
            "description": "Authentication or access required"
          },
          "404": {
            "description": "Owner resource not found"
          },
          "409": {
            "description": "Conflict or unavailable reservation"
          },
          "429": {
            "description": "Rate limit"
          },
          "503": {
            "description": "Service unavailable"
          }
        }
      }
    },
    "/api/panel": {
      "get": {
        "summary": "List latest 500 jobs owned by authenticated wallet",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "jobs"
                  ],
                  "properties": {
                    "jobs": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ManagedJob"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request"
          },
          "403": {
            "description": "Authentication or access required"
          },
          "404": {
            "description": "Owner resource not found"
          },
          "409": {
            "description": "Conflict or unavailable reservation"
          },
          "429": {
            "description": "Rate limit"
          },
          "503": {
            "description": "Service unavailable"
          }
        },
        "security": [
          {
            "walletSession": []
          }
        ]
      },
      "post": {
        "summary": "Atomically start a batch or update owned leased jobs",
        "responses": {
          "200": {
            "description": "Success"
          },
          "400": {
            "description": "Invalid request"
          },
          "403": {
            "description": "Authentication or access required"
          },
          "404": {
            "description": "Owner resource not found"
          },
          "409": {
            "description": "Conflict or unavailable reservation"
          },
          "429": {
            "description": "Rate limit"
          },
          "503": {
            "description": "Service unavailable"
          }
        },
        "security": [
          {
            "walletSession": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "required": [
                      "action",
                      "runnerId",
                      "patterns"
                    ],
                    "properties": {
                      "action": {
                        "const": "start"
                      },
                      "runnerId": {
                        "type": "string",
                        "pattern": "^[-a-zA-Z0-9]{1,64}$"
                      },
                      "patterns": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 10,
                        "items": {
                          "$ref": "#/components/schemas/Pattern"
                        }
                      }
                    }
                  },
                  {
                    "type": "object",
                    "required": [
                      "action",
                      "runnerId",
                      "jobs"
                    ],
                    "properties": {
                      "action": {
                        "enum": [
                          "heartbeat",
                          "resume",
                          "pause",
                          "cancel"
                        ]
                      },
                      "runnerId": {
                        "type": "string",
                        "pattern": "^[-a-zA-Z0-9]{1,64}$"
                      },
                      "jobs": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 10,
                        "items": {
                          "$ref": "#/components/schemas/JobProgress"
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        }
      }
    },
    "/api/payments": {
      "post": {
        "summary": "Quote an unsigned payment or verify an existing finalized transaction",
        "responses": {
          "200": {
            "description": "Success"
          },
          "400": {
            "description": "Invalid request"
          },
          "403": {
            "description": "Authentication or access required"
          },
          "404": {
            "description": "Owner resource not found"
          },
          "409": {
            "description": "Conflict or unavailable reservation"
          },
          "429": {
            "description": "Rate limit"
          },
          "503": {
            "description": "Service unavailable"
          }
        },
        "security": [
          {
            "walletSession": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "required": [
                      "action",
                      "length",
                      "currency"
                    ],
                    "properties": {
                      "action": {
                        "const": "quote"
                      },
                      "length": {
                        "type": "integer",
                        "enum": [
                          4,
                          5,
                          6
                        ]
                      },
                      "currency": {
                        "enum": [
                          "USDC",
                          "SOL"
                        ]
                      }
                    }
                  },
                  {
                    "type": "object",
                    "required": [
                      "action",
                      "quoteId",
                      "signature"
                    ],
                    "properties": {
                      "action": {
                        "const": "confirm"
                      },
                      "quoteId": {
                        "type": "string"
                      },
                      "signature": {
                        "type": "string"
                      }
                    }
                  }
                ]
              }
            }
          }
        }
      },
      "get": {
        "summary": "List recent uncredited quotes for payment recovery",
        "responses": {
          "200": {
            "description": "Success"
          },
          "400": {
            "description": "Invalid request"
          },
          "403": {
            "description": "Authentication or access required"
          },
          "404": {
            "description": "Owner resource not found"
          },
          "409": {
            "description": "Conflict or unavailable reservation"
          },
          "429": {
            "description": "Rate limit"
          },
          "503": {
            "description": "Service unavailable"
          }
        },
        "security": [
          {
            "walletSession": []
          }
        ]
      }
    },
    "/api/jobs/complete": {
      "post": {
        "summary": "Confirm a matching address with generated-key signature after saving its key",
        "responses": {
          "200": {
            "description": "Success"
          },
          "400": {
            "description": "Invalid request"
          },
          "403": {
            "description": "Authentication or access required"
          },
          "404": {
            "description": "Owner resource not found"
          },
          "409": {
            "description": "Conflict or unavailable reservation"
          },
          "429": {
            "description": "Rate limit"
          },
          "503": {
            "description": "Service unavailable"
          }
        },
        "security": [
          {
            "walletSession": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "jobId",
                  "address",
                  "signature"
                ],
                "properties": {
                  "jobId": {
                    "type": "string"
                  },
                  "address": {
                    "type": "string"
                  },
                  "signature": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/feed": {
      "get": {
        "summary": "Read confirmed public wallet feed",
        "responses": {
          "200": {
            "description": "Success"
          },
          "400": {
            "description": "Invalid request"
          },
          "403": {
            "description": "Authentication or access required"
          },
          "404": {
            "description": "Owner resource not found"
          },
          "409": {
            "description": "Conflict or unavailable reservation"
          },
          "429": {
            "description": "Rate limit"
          },
          "503": {
            "description": "Service unavailable"
          }
        }
      }
    },
    "/api/ledger": {
      "get": {
        "summary": "Read confirmed payments, reserved allocation and burn receipts",
        "responses": {
          "200": {
            "description": "Success"
          },
          "400": {
            "description": "Invalid request"
          },
          "403": {
            "description": "Authentication or access required"
          },
          "404": {
            "description": "Owner resource not found"
          },
          "409": {
            "description": "Conflict or unavailable reservation"
          },
          "429": {
            "description": "Rate limit"
          },
          "503": {
            "description": "Service unavailable"
          }
        }
      }
    }
  }
}
