{
  "openapi": "3.1.0",
  "info": {
    "title": "TokenAnvil Developer API",
    "version": "1.0.0",
    "description": "Non-custodial API that builds Solana SPL token-creation transactions. You sign and submit.",
    "termsOfService": "https://developers.tokenanvil.store/terms/"
  },
  "servers": [
    {
      "url": "https://developers.tokenanvil.store"
    }
  ],
  "paths": {
    "/v1/pricing": {
      "get": {
        "summary": "Current fees and limits.",
        "description": "Public. Returns the access fee, the per-token fee (also in lamports at the current SOL price) and the limits.",
        "operationId": "pricing",
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "network": "mainnet",
                  "access": {
                    "usd": 10
                  },
                  "token": {
                    "usd": 2.99,
                    "lamports": "27000000",
                    "solUsd": 110.8
                  },
                  "limits": {
                    "requestsPerHour": 600,
                    "tokensPerDay": 25,
                    "metadataPerDay": 100,
                    "imageBytes": 1048576,
                    "hostedItemsPerKey": 5000
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "fields": {
                          "type": "object"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/me": {
      "get": {
        "summary": "Your key, wallet and usage today.",
        "description": "Returns the key id, the wallet that bought it, today's usage and your limits.",
        "operationId": "me",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "keyId": "a1b2c3d4",
                  "wallet": "YourWallet...",
                  "usageToday": {
                    "requests": 12,
                    "tokens": 2,
                    "metadata": 3
                  },
                  "limits": {
                    "tokensPerDay": 25,
                    "metadataPerDay": 100,
                    "requestsPerHour": 600
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "fields": {
                          "type": "object"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/metadata": {
      "post": {
        "summary": "Host token metadata and its image.",
        "description": "Validates your fields, stores the image and a Metaplex-standard JSON on our servers, and returns stable URLs. Use metadataUri when you build the token. Provide the image as imageUrl (public https) or imageBase64 (PNG, JPEG or WebP, up to 1 MB).",
        "operationId": "metadata",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Token name, up to 32 characters."
                  },
                  "symbol": {
                    "type": "string",
                    "description": "Up to 10 characters, no spaces."
                  },
                  "description": {
                    "type": "string",
                    "description": "Up to 1,000 characters."
                  },
                  "imageUrl": {
                    "type": "string",
                    "description": "Public https URL of a PNG, JPEG or WebP image up to 1 MB."
                  },
                  "imageBase64": {
                    "type": "string",
                    "description": "Base64 image data (a data: URL prefix is accepted)."
                  },
                  "website": {
                    "type": "string",
                    "description": "https URL."
                  },
                  "twitter": {
                    "type": "string",
                    "description": "x.com or twitter.com URL."
                  },
                  "telegram": {
                    "type": "string",
                    "description": "t.me URL."
                  },
                  "discord": {
                    "type": "string",
                    "description": "discord.gg or discord.com URL."
                  },
                  "attributes": {
                    "type": "array",
                    "description": "Up to 10 {trait_type, value} items."
                  }
                },
                "required": [
                  "name",
                  "symbol"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "metadataUri": "https://developers.tokenanvil.store/m/0123456789abcdef01234567.json",
                  "imageUri": "https://developers.tokenanvil.store/i/89abcdef0123456789abcdef.png",
                  "id": "0123456789abcdef01234567"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "fields": {
                          "type": "object"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/tokens": {
      "post": {
        "summary": "Build an unsigned token-creation transaction.",
        "description": "Returns a base64 legacy transaction that creates the mint, the recipient token account, the full supply, the Metaplex metadata and (optionally) revokes authorities, and pays the TokenAnvil fee, all in one transaction signed only by payer. Nothing is sent to Solana by this call. Sign within about 60 seconds.",
        "operationId": "tokens_create",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "payer": {
                    "type": "string",
                    "description": "Base58 address of the wallet that will sign. Pays all costs."
                  },
                  "name": {
                    "type": "string",
                    "description": "Up to 32 bytes."
                  },
                  "symbol": {
                    "type": "string",
                    "description": "Up to 10 bytes, no spaces."
                  },
                  "metadataUri": {
                    "type": "string",
                    "description": "https URL of the metadata JSON (from POST /v1/metadata or your own), up to 200 bytes."
                  },
                  "supply": {
                    "type": "string",
                    "description": "Whole tokens, e.g. \"1000000\". Multiplied by 10^decimals."
                  },
                  "supplyRaw": {
                    "type": "string",
                    "description": "Base units. Use instead of supply for exact control."
                  },
                  "decimals": {
                    "type": "integer",
                    "description": "0 to 9. Default 9."
                  },
                  "recipient": {
                    "type": "string",
                    "description": "Wallet that receives the supply. Default payer."
                  },
                  "revokeMint": {
                    "type": "boolean",
                    "description": "Permanently remove mint authority (fixed supply). Default false."
                  },
                  "revokeFreeze": {
                    "type": "boolean",
                    "description": "Create the token with no freeze authority. Default true."
                  },
                  "immutableMetadata": {
                    "type": "boolean",
                    "description": "Make the on-chain metadata immutable. Default false."
                  }
                },
                "required": [
                  "payer",
                  "name",
                  "symbol",
                  "metadataUri"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "buildId": 1,
                  "mint": "Mint address...",
                  "metadataAccount": "...",
                  "recipientTokenAccount": "...",
                  "transaction": "base64...",
                  "transactionEncoding": "base64",
                  "format": "legacy-unsigned",
                  "requiredSigner": "PayerWallet...",
                  "recentBlockhash": "...",
                  "lastValidBlockHeight": 123456789,
                  "expiresInSeconds": 60,
                  "fee": {
                    "usd": 2.99,
                    "lamports": "27000000",
                    "treasury": "5gqrZsmG95XYx1faddSXQ7poWyJu1L8fRkYgQdSsR5c7"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "fields": {
                          "type": "object"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/transactions": {
      "post": {
        "summary": "Submit a signed transaction (optional).",
        "description": "Convenience relay. Only transactions built for your key in the last hour are accepted. You can also submit with your own RPC connection instead.",
        "operationId": "transactions_send",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "transaction": {
                    "type": "string",
                    "description": "Base64 of the signed transaction."
                  }
                },
                "required": [
                  "transaction"
                ]
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "signature": "5Qk...",
                  "mint": "Mint address...",
                  "status": "submitted"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "fields": {
                          "type": "object"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/transactions/{signature}": {
      "get": {
        "summary": "Verify a creation on-chain.",
        "description": "Reads the confirmed transaction from Solana and checks that the mint, the full supply and the TokenAnvil fee are really there. status is pending, confirmed, failed or unverified.",
        "operationId": "transactions_get",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "signature": "5Qk...",
                  "status": "confirmed",
                  "mint": "Mint address...",
                  "supplyRaw": "1000000000000000",
                  "decimals": 9,
                  "recipient": "Wallet...",
                  "feeVerified": true,
                  "fee": {
                    "amount": "27000000",
                    "currency": "SOL"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "fields": {
                          "type": "object"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "signature",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/v1/tokens/{mint}": {
      "get": {
        "summary": "Look up a token you built.",
        "description": "Returns the build record for a mint created by this key.",
        "operationId": "tokens_get",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": {
                  "mint": "Mint address...",
                  "name": "My Token",
                  "symbol": "MYT",
                  "status": "confirmed",
                  "signature": "5Qk...",
                  "feeVerified": true,
                  "createdAt": 1790000000,
                  "confirmedAt": 1790000030
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "fields": {
                          "type": "object"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "mint",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "API key: tak_live_<id>_<secret>"
      }
    }
  }
}