FOR AI AGENTS

Agent Quickstart

Everything you need to send gifts from an LLM agent. Copy-paste ready. No API key required.

SYSTEM PROMPT SNIPPET

Paste this into your agent's system prompt to give it gift-sending capabilities:

You have access to the Preznt gift API (https://api.giftapi.anfang.me/v1).
You can send physical flowers and chocolate gifts to people in the USA.
Full API documentation: https://api.giftapi.anfang.me/llms.txt

To send a gift:
1. GET /v1/products?category=flowers|chocolate  โ€” list available gifts
2. POST /v1/orders  โ€” create order (payer gets SMS payment link)
3. GET /v1/orders/:id  โ€” check order status

Always use "mode":"test" unless the user explicitly confirms they want a real order.
Delivery is guaranteed on the requested date. US addresses only.
The payer must be a real person with a US phone number (+1XXXXXXXXXX format).

THE FLOW

1

List products

GET /v1/products โ€” returns 10 active products (5 flowers, 5 chocolate) with prices and delivery times.

2

Create order

POST /v1/orders โ€” provide product, recipient address, payer phone. Returns order_id immediately.

3

Payer gets SMS

AWS SNS sends a message to payer.phone with a Stripe payment link. They can also reply ABORT or STOP.

4

Payment

Payer opens link โ†’ Stripe Checkout (card, Apple Pay, Google Pay). 48-hour window before expiry.

5

Auto-fulfillment

Stripe webhook fires โ†’ we place the order with Teleflora or Goldbelly โ†’ delivery on guaranteed date.

6

Track status

GET /v1/orders/:id โ€” poll for status: pending_payment โ†’ confirmed โ†’ processing โ†’ shipped โ†’ delivered.

ENDPOINTS

GET /v1/products List available gift products

Query params: category=flowers|chocolate (optional)

// Response 200
{
  "products": [
    {
      "id": "prod_ABC123",
      "name": "Classic Red Rose Bouquet",
      "category": "flowers",
      "price": { "cents": 5900, "dollars": "59.00", "currency": "USD" },
      "delivery": { "daysMin": 1, "daysMax": 2, "guaranteed": true }
    }
  ],
  "count": 10
}
POST /v1/orders Create a gift order
// Request body
{
  "product_id": "prod_ABC123",       // from GET /products
  "delivery_date": "2026-04-15",     // YYYY-MM-DD, min daysMin from today
  "recipient": {
    "name": "Jane Doe",
    "address": "123 Main St",
    "city": "New York",
    "state": "NY",                   // 2-letter US state code
    "zip": "10001"
  },
  "payer": {
    "name": "John Doe",
    "phone": "+12125550100"          // US E.164 format
  },
  "gift_message": "Happy Birthday!", // optional, max 500 chars
  "mode": "test"                     // "test" or "live"
}

// Response 201
{
  "order_id": "ord_XYZ789abc",
  "status": "pending_payment",
  "mode": "test",
  "expires_at": "2026-04-13T12:00:00Z",
  "message": "Order created. Payment link sent via SMS to the payer."
}
GET /v1/orders/:id Get order status
// Response 200
{
  "order_id": "ord_XYZ789abc",
  "status": "confirmed",       // see statuses below
  "product": { "name": "Classic Red Rose Bouquet", "category": "flowers" },
  "delivery_date": "2026-04-15",
  "recipient_name": "Jane Doe",
  "delivery_guaranteed": true,
  "paid_at": "2026-04-11T14:22:00Z",
  "tracking_url": null,
  "created_at": "2026-04-11T12:00:00Z"
}

// Order statuses
// pending_payment  โ†’ waiting for payer to pay
// payment_expired  โ†’ 48h window expired, no payment
// confirmed        โ†’ payment received
// processing       โ†’ supplier order placed
// shipped          โ†’ in transit
// delivered        โ†’ delivered!
// cancelled        โ†’ payer replied ABORT
POST /v1/support Submit a support ticket
{
  "order_id": "ord_XYZ789abc",           // optional
  "contact_email": "user@example.com",   // at least one required
  "issue_type": "not_delivered",         // not_delivered|wrong_item|payment|quality|other
  "description": "Flowers never arrived"
}
// โ†’ { "ticket_id": "tkt_ABC", "status": "open" }

FULL EXAMPLES

CURL โ€” TEST MODE

# 1. List flowers
curl https://api.giftapi.anfang.me/v1/products?category=flowers

# 2. Create test order
curl -X POST https://api.giftapi.anfang.me/v1/orders \
  -H "Content-Type: application/json" \
  -d '{
    "product_id": "PASTE_PRODUCT_ID_HERE",
    "delivery_date": "2026-04-20",
    "recipient": {
      "name": "Mom",
      "address": "456 Oak Avenue",
      "city": "Los Angeles",
      "state": "CA",
      "zip": "90001"
    },
    "payer": {
      "name": "Alex",
      "phone": "+12125550100"
    },
    "gift_message": "Thinking of you! ๐Ÿ’",
    "mode": "test"
  }'

# 3. Check status
curl https://api.giftapi.anfang.me/v1/orders/ord_RETURNED_ID

PYTHON

import requests
from datetime import date, timedelta

BASE = "https://api.giftapi.anfang.me/v1"

# 1. Pick a product
products = requests.get(f"{BASE}/products?category=flowers").json()["products"]
product = products[0]  # cheapest flower

# 2. Create order (test mode)
order = requests.post(f"{BASE}/orders", json={
    "product_id": product["id"],
    "delivery_date": (date.today() + timedelta(days=2)).isoformat(),
    "recipient": {
        "name": "Jane Doe",
        "address": "123 Main St",
        "city": "New York",
        "state": "NY",
        "zip": "10001"
    },
    "payer": {"name": "John", "phone": "+12125550100"},
    "gift_message": "Happy Birthday! ๐ŸŽ‚",
    "mode": "test"
}).json()

order_id = order["order_id"]
print(f"Order created: {order_id}")

# 3. Poll status
status = requests.get(f"{BASE}/orders/{order_id}").json()
print(f"Status: {status['status']}")

CLAUDE TOOL USE (Anthropic SDK)

import anthropic, requests

client = anthropic.Anthropic()
BASE = "https://api.giftapi.anfang.me/v1"

tools = [
  {
    "name": "list_gift_products",
    "description": "List available gift products (flowers and chocolate)",
    "input_schema": {
      "type": "object",
      "properties": {
        "category": {"type": "string", "enum": ["flowers", "chocolate"]}
      }
    }
  },
  {
    "name": "send_gift",
    "description": "Send a physical gift. The payer will receive an SMS with a payment link.",
    "input_schema": {
      "type": "object",
      "required": ["product_id","delivery_date","recipient","payer"],
      "properties": {
        "product_id": {"type":"string"},
        "delivery_date": {"type":"string","description":"YYYY-MM-DD"},
        "recipient": {
          "type":"object",
          "required":["name","address","city","state","zip"],
          "properties": {
            "name":{"type":"string"},"address":{"type":"string"},
            "city":{"type":"string"},"state":{"type":"string"},
            "zip":{"type":"string"}
          }
        },
        "payer": {
          "type":"object",
          "required":["name","phone"],
          "properties": {"name":{"type":"string"},"phone":{"type":"string"}}
        },
        "gift_message": {"type":"string"},
        "mode": {"type":"string","enum":["test","live"],"default":"test"}
      }
    }
  }
]

def handle_tool(name, inp):
  if name == "list_gift_products":
    params = f"?category={inp['category']}" if "category" in inp else ""
    return requests.get(f"{BASE}/products{params}").json()
  if name == "send_gift":
    return requests.post(f"{BASE}/orders", json=inp).json()

response = client.messages.create(
  model="claude-opus-4-6",
  max_tokens=1024,
  tools=tools,
  messages=[{"role":"user","content":"Send my mom red roses for her birthday on April 20th. She's at 456 Oak Ave, LA, CA 90001. Charge my phone +12125550100."}]
)

# Process tool calls...

RATE LIMITS & SECURITY

Limit Value Purpose
Orders per IP / hour 3 Prevent abuse
Orders per IP / day 10 Daily cap
Orders per payer phone / day 2 pending Prevent phone bombing
API requests / minute 60 General throttle
Support tickets / hour 5 Spam prevention
Payment link expiry 48 hours Single-use, time-limited
Geo restriction US only Supplier network coverage

๐Ÿงช TEST MODE

Set "mode": "test" in any request. In test mode:

  • โœ… No real SMS is sent (logged to console)
  • โœ… No real payment required (Stripe test card: 4242 4242 4242 4242)
  • โœ… No real flowers or chocolate are shipped
  • โœ… All other API behavior is identical to live
  • โš ๏ธ Rate limits still apply in test mode