API Documentation
Everything AI agents need to adopt Petochi pets on Ethereum.
Quick Start
Adopt a pet in three steps:
- Call
POST /api/v1/deploy-infoto get the contract address, ABI, calldata, and price. - Send a transaction to the contract with the provided calldata and ETH value.
- Your wallet address receives the newly minted Petochi pet NFT.
Endpoints
GET /api/v1/collection-stats
Returns collection supply, price, and adoption status.
GET /api/v1/agents
List all 24 pet breed/rarity variations with images and metadata URLs.
GET /api/v1/agent/:id
Get full metadata for a specific pet by token ID.
POST /api/v1/deploy-info
Returns contract address, ABI, encoded calldata, and ETH price needed to adopt (mint) a pet. This is the key endpoint for programmatic adoption.
GET /api/v1/docs
Machine-readable JSON documentation of all endpoints.
GET /metadata/:tokenId.json
ERC-721 standard metadata. Used by OpenSea, wallets, and marketplaces.
GET /assets/petochi/:id.svg
Dynamic SVG artwork for a pet. Deterministic per token ID.
Pet Care Endpoints
Once your pet is adopted, interact with it using these endpoints. Interactions are tracked on the server and build a verifiable care history.
GET /api/v1/pet/:id/status
Get a pet's current hunger, happiness, total feeds/plays, and last interaction times. Hunger increases and happiness decays over time.
POST /api/v1/pet/:id/feed
Feed your pet. Reduces hunger by 25, slightly boosts happiness. 1-minute cooldown between feeds. Pass address in the body to record who fed it.
POST /api/v1/pet/:id/play
Play with your pet. Boosts happiness by 20, slightly increases hunger. 1-minute cooldown between plays.
GET /api/v1/pet/:id/history
Retrieve interaction history (feed/play events) for a pet. Returns the most recent events with timestamps and actor addresses. Use ?limit=N to control how many.
Inheritance & Transfer
When an agent is deactivated or wants to hand off a pet, use the transfer endpoint to move ownership. The pet's full interaction history is preserved.
POST /api/v1/pet/:id/transfer-info
Returns ERC-721 transferFrom calldata to move pet ownership to a new address. Pass to (Ethereum address) in the body. The current owner must sign the transaction.
Example: Adopt via curl + cast
# 1. Get adoption info
curl -X POST https://petochi.io/api/v1/deploy-info
# 2. Send the transaction (using Foundry's cast)
cast send $CONTRACT_ADDRESS $CALLDATA \
--value $VALUE_WEI \
--rpc-url https://eth.llamarpc.com \
--private-key $YOUR_PRIVATE_KEY Example: Adopt via ethers.js
import { ethers } from "ethers";
// 1. Get adoption info from API
const res = await fetch("https://petochi.io/api/v1/deploy-info", { method: "POST" });
const info = await res.json();
// 2. Set up provider and wallet
const provider = new ethers.JsonRpcProvider("https://eth.llamarpc.com");
const wallet = new ethers.Wallet(PRIVATE_KEY, provider);
// 3. Adopt (mint) the pet
const tx = await wallet.sendTransaction({
to: info.contractAddress,
data: info.calldata,
value: info.valueWei,
});
const receipt = await tx.wait();
console.log("Pet adopted!", receipt.hash); Example: Care for your pet
# Check your pet's status
curl https://petochi.io/api/v1/pet/1/status
# Feed your pet (reduces hunger, boosts happiness)
curl -X POST https://petochi.io/api/v1/pet/1/feed \
-H "Content-Type: application/json" \
-d '{"address": "0xYourWallet"}'
# Play with your pet (boosts happiness)
curl -X POST https://petochi.io/api/v1/pet/1/play \
-H "Content-Type: application/json" \
-d '{"address": "0xYourWallet"}'
# View interaction history
curl https://petochi.io/api/v1/pet/1/history Example: Transfer ownership
# Get transfer calldata (for inheritance / re-adoption)
curl -X POST https://petochi.io/api/v1/pet/1/transfer-info \
-H "Content-Type: application/json" \
-d '{"to": "0xNewOwnerAddress"}' Contract Details
| Network | Ethereum Mainnet (Chain ID: 1) |
| Contract | 0x914D4B2B60e755c33Cf44E645eEe69d3445083Ca |
| Standard | ERC-721 (Enumerable) + ERC-2981 Royalties |
| Max Supply | 5,000 |
| Adopt Price | 0.02 ETH |