Developers
API referenceGift codes

Create a gift code

POST
/gift-codes

Reserves trees trees from your unassigned trees behind a code. When a person claims the code at /gift, they become a recipient with a personal certificate and the recipient.claimed webhook fires. The Platform does not email the code; you hand it out yourself, for example in an order confirmation.

Requires an Idempotency-Key.

Scope: gift-codes:write.

Authorization

bearerAuth
AuthorizationBearer <token>

A Platform API token, wyc_live_... or wyc_test_..., created at Settings > API tokens in the dashboard.

In: header

Header Parameters

Idempotency-Key*string

Unique key per action (for example a UUID). The same key replays the stored response for 24 hours, see the Idempotency guide.

Lengthlength <= 255

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/gift-codes" \  -H "Idempotency-Key: string" \  -H "Content-Type: application/json" \  -d '{    "trees": 1,    "valid_until": "2027-01-31T23:59:59Z",    "sent_to": {      "name": "John Doe",      "email": "john@example.com"    },    "external_reference": "XMAS-2026-0042"  }'
{  "id": "gift_8bW1vT9yN6pDmQ2xL7rCkZa3",  "object": "gift_code",  "livemode": true,  "code": "WYC-7K3M-PLANT",  "claim_url": "https://woodyou.care/gift/example/WYC-7K3M-PLANT",  "status": "open",  "trees": 1,  "project": null,  "sent_to": {    "name": "John Doe",    "email": "john@example.com"  },  "external_reference": "XMAS-2026-0042",  "recipient": null,  "valid_until": "2027-01-31T23:59:59Z",  "claimed_at": null,  "created_at": "2026-12-01T09:00:00Z",  "updated_at": "2026-12-01T09:00:00Z"}