{"openapi":"3.1.0","info":{"title":"Mail & Post API","description":"WhatsApp-first postcard ordering platform powered by LLMs","version":"0.1.0"},"paths":{"/api/v1/webhooks/kapso":{"post":{"tags":["webhooks"],"summary":"Kapso Webhook","description":"Handle incoming WhatsApp messages from Kapso (v2 format).\n\nKapso v2 webhook payload format:\n{\n    \"message\": {\n        \"id\": \"wamid.123\",\n        \"timestamp\": \"1730092800\",\n        \"type\": \"text\",\n        \"text\": {\"body\": \"Hello\"},\n        \"kapso\": {\n            \"direction\": \"inbound\" | \"outbound\",\n            \"status\": \"received\" | \"delivered\" | \"read\",\n            \"content\": \"Hello\",\n            \"media_url\": \"https://...\" (for media messages)\n        }\n    },\n    \"conversation\": {\n        \"id\": \"conv_123\",\n        \"phone_number\": \"+15551234567\",\n        \"status\": \"active\"\n    },\n    \"is_new_conversation\": true,\n    \"phone_number_id\": \"123456789012345\"\n}","operationId":"kapso_webhook_api_v1_webhooks_kapso_post","parameters":[{"name":"x-webhook-signature","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Webhook-Signature"}},{"name":"x-idempotency-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Idempotency-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KapsoWebhookResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/webhooks/stripe":{"post":{"tags":["webhooks"],"summary":"Stripe Webhook","description":"Handle Stripe payment webhooks.","operationId":"stripe_webhook_api_v1_webhooks_stripe_post","parameters":[{"name":"stripe-signature","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stripe-Signature"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StripeWebhookResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/webhooks/prodigi":{"post":{"tags":["webhooks"],"summary":"Prodigi Webhook","description":"Handle Prodigi fulfillment webhooks using CloudEvents format.\n\nProdigi sends webhooks in CloudEvents format with event types like:\n- com.prodigi.order.status.stage.changed#InProgress\n- com.prodigi.order.status.stage.changed#Complete\n- com.prodigi.order.status.stage.changed#Cancelled\n\nThe status stage is extracted from after the '#' in the type field.\n\nNotification strategy:\n- InProgress: No user notification (already sent at payment time).\n  Safety-net transition to FULFILLING if still PAID.\n- Complete: All shipments sent. Transition to SHIPPED and notify user.\n  Notification is gated on the order status actually changing, so\n  duplicate webhooks are harmless.\n- Cancelled: Transition to CANCELLED and notify user.\n\nThe ProdigiOrder record (status, tracking, details, issues, raw payload)\nis always updated regardless of whether a notification is sent.","operationId":"prodigi_webhook_api_v1_webhooks_prodigi_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProdigiWebhookResponse"}}}}}}},"/api/v1/webhooks/lob":{"post":{"tags":["webhooks"],"summary":"Lob Webhook","description":"Handle Lob fulfillment webhooks.\n\nLob sends webhooks for postcard lifecycle events:\n- postcard.created: Postcard accepted by Lob\n- postcard.rendered_pdf: PDF proof rendered\n- postcard.mailed: Postcard entered mail stream\n- postcard.in_transit: In transit via USPS\n- postcard.in_local_area: In local delivery area\n- postcard.processed_for_delivery: Delivered or at final sort facility\n- postcard.re_routed: Re-routed during delivery\n- postcard.returned_to_sender: Could not be delivered\n\nNotifications:\n- mailed: No notification (already sent at payment time)\n- processed_for_delivery: Transition to SHIPPED and notify user\n- returned_to_sender: Notify user of delivery failure","operationId":"lob_webhook_api_v1_webhooks_lob_post","parameters":[{"name":"Lob-Signature","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lob-Signature"}},{"name":"Lob-Signature-Timestamp","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lob-Signature-Timestamp"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LobWebhookResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/otp":{"post":{"tags":["auth"],"summary":"Request Otp","description":"Request a one-time password for phone verification.","operationId":"request_otp_api_v1_auth_otp_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OtpRequestBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/verify":{"post":{"tags":["auth"],"summary":"Verify Otp","description":"Verify OTP code and return an API key.","operationId":"verify_otp_api_v1_auth_verify_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyOtpBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyOtpResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/keys":{"post":{"tags":["auth"],"summary":"Regenerate Api Key","description":"Regenerate API key for the current user.","operationId":"regenerate_api_key_api_v1_auth_keys_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyResponse"}}}}},"security":[{"HTTPBearer":[]}]},"delete":{"tags":["auth"],"summary":"Revoke Api Keys","description":"Revoke all API keys for the current user.","operationId":"revoke_api_keys_api_v1_auth_keys_delete","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/orders/":{"get":{"tags":["orders"],"summary":"List Orders","description":"List orders. Users see own orders; admins see all (with optional filters).","operationId":"list_orders_api_v1_orders__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by user ID (admin only)","title":"User Id"},"description":"Filter by user ID (admin only)"},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by status","title":"Status"},"description":"Filter by status"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["orders"],"summary":"Create Order","description":"Create a new postcard order.","operationId":"create_order_api_v1_orders__post","security":[{"HTTPBearer":[]}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/CreateOrderBody"},{"type":"null"}],"title":"Body"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/orders/{order_id}":{"get":{"tags":["orders"],"summary":"Get Order","description":"Get full order details. Auto-syncs payment status when PENDING_PAYMENT.","operationId":"get_order_api_v1_orders__order_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","title":"Order Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["orders"],"summary":"Update Order","description":"Update order status. Currently only supports unlocking to DRAFT.","operationId":"update_order_api_v1_orders__order_id__patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","title":"Order Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateOrderBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/orders/{order_id}/slots":{"patch":{"tags":["orders"],"summary":"Update Slots","description":"Update order slots. Order must be in DRAFT status.","operationId":"update_slots_api_v1_orders__order_id__slots_patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","title":"Order Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSlotsBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSlotsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/orders/{order_id}/codes":{"post":{"tags":["orders"],"summary":"Apply Code","description":"Apply a code to an order. Allowed in DRAFT and IN_REVIEW.","operationId":"apply_code_api_v1_orders__order_id__codes_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","title":"Order Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplyCodeBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplyCodeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/orders/{order_id}/previews":{"post":{"tags":["orders"],"summary":"Create Preview","description":"Generate and store a postcard preview image.","operationId":"create_preview_api_v1_orders__order_id__previews_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","title":"Order Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/orders/{order_id}/payments":{"post":{"tags":["orders"],"summary":"Create Payment","description":"Create a Stripe payment session for the order.","operationId":"create_payment_api_v1_orders__order_id__payments_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","title":"Order Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/orders/{order_id}/fulfillments":{"post":{"tags":["orders"],"summary":"Submit Fulfillment","description":"Submit order for fulfillment via the provider router (admin only).","operationId":"submit_fulfillment_api_v1_orders__order_id__fulfillments_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","title":"Order Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FulfillmentSubmitResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/orders/{order_id}/payments/sync":{"post":{"tags":["orders"],"summary":"Sync Payment","description":"Sync payment status from Stripe (admin only).","operationId":"sync_payment_api_v1_orders__order_id__payments_sync_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","title":"Order Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentSyncResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/addresses/":{"get":{"tags":["addresses"],"summary":"List Or Search Addresses","description":"Search for addresses or list saved addresses.","operationId":"list_or_search_addresses_api_v1_addresses__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"q","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Search query for address autocomplete","title":"Q"},"description":"Search query for address autocomplete"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddressListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/addresses/{address_id}":{"get":{"tags":["addresses"],"summary":"Get Address","description":"Get a single address by ID.","operationId":"get_address_api_v1_addresses__address_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"address_id","in":"path","required":true,"schema":{"type":"string","title":"Address Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddressResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["addresses"],"summary":"Delete Address","description":"Delete an address.","operationId":"delete_address_api_v1_addresses__address_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"address_id","in":"path","required":true,"schema":{"type":"string","title":"Address Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/recipients/":{"get":{"tags":["recipients"],"summary":"List Recipients","description":"List recipients for the current user, or all recipients for admins.","operationId":"list_recipients_api_v1_recipients__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecipientListResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/recipients/{recipient_id}":{"get":{"tags":["recipients"],"summary":"Get Recipient","description":"Get a single recipient by ID.","operationId":"get_recipient_api_v1_recipients__recipient_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"recipient_id","in":"path","required":true,"schema":{"type":"string","title":"Recipient Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecipientResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["recipients"],"summary":"Delete Recipient","description":"Delete a recipient.","operationId":"delete_recipient_api_v1_recipients__recipient_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"recipient_id","in":"path","required":true,"schema":{"type":"string","title":"Recipient Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/assets/":{"post":{"tags":["assets"],"summary":"Upload Asset","description":"Upload an image asset.","operationId":"upload_asset_api_v1_assets__post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_asset_api_v1_assets__post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssetResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/assets/{asset_id}":{"get":{"tags":["assets"],"summary":"Get Asset","description":"Get an asset by ID.","operationId":"get_asset_api_v1_assets__asset_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"asset_id","in":"path","required":true,"schema":{"type":"string","title":"Asset Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssetResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/users/":{"get":{"tags":["users"],"summary":"List Users","description":"List all users (admin only).","operationId":"list_users_api_v1_users__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserListResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/users/{user_id}":{"get":{"tags":["users"],"summary":"Get User","description":"Get a user by ID.","operationId":"get_user_api_v1_users__user_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/users/{user_id}/messages":{"post":{"tags":["users"],"summary":"Send Message","description":"Send a message to a user (admin only).\n\ndirection=\"inbound\": stores as inbound, runs through LLM pipeline, sends LLM response via WhatsApp.\ndirection=\"outbound\": sends message directly to user via WhatsApp, stores as outbound.","operationId":"send_message_api_v1_users__user_id__messages_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendMessageRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendMessageResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/fulfillments/poll":{"post":{"tags":["fulfillments"],"summary":"Poll Fulfillments","description":"Poll all fulfillment providers for status updates (admin only).","operationId":"poll_fulfillments_api_v1_fulfillments_poll_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/codes/":{"post":{"tags":["codes"],"summary":"Create Code","description":"Create a new code (admin only).","operationId":"create_code_api_v1_codes__post","security":[{"HTTPBearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CodeCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CodeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["codes"],"summary":"List Codes","description":"List all codes (admin only).","operationId":"list_codes_api_v1_codes__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"default":100,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CodeListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/codes/users/{user_id}/balance":{"get":{"tags":["codes"],"summary":"Get User Balance","description":"Get user's ledger balance (admin only).","operationId":"get_user_balance_api_v1_codes_users__user_id__balance_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserBalanceResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/codes/users/{user_id}/transactions":{"get":{"tags":["codes"],"summary":"Get User Transactions","description":"Get user's ledger transactions (admin only).","operationId":"get_user_transactions_api_v1_codes_users__user_id__transactions_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LedgerListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/codes/{code_id}":{"get":{"tags":["codes"],"summary":"Get Code","description":"Get a single code (admin only).","operationId":"get_code_api_v1_codes__code_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"code_id","in":"path","required":true,"schema":{"type":"string","title":"Code Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CodeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["codes"],"summary":"Update Code","description":"Update a code (admin only). Only provided fields are updated.","operationId":"update_code_api_v1_codes__code_id__patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"code_id","in":"path","required":true,"schema":{"type":"string","title":"Code Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CodeUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CodeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/codes/{code_id}/redemptions":{"get":{"tags":["codes"],"summary":"List Code Redemptions","description":"List redemptions for a code (admin only).","operationId":"list_code_redemptions_api_v1_codes__code_id__redemptions_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"code_id","in":"path","required":true,"schema":{"type":"string","title":"Code Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RedemptionListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/health":{"get":{"summary":"Health Check","description":"Health check endpoint.","operationId":"health_check_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}}},"components":{"schemas":{"AddressListResponse":{"properties":{"addresses":{"items":{"$ref":"#/components/schemas/AddressResponse"},"type":"array","title":"Addresses"}},"type":"object","required":["addresses"],"title":"AddressListResponse","description":"Response for address list or search."},"AddressResponse":{"properties":{"id":{"type":"string","title":"Id"},"formatted_address":{"type":"string","title":"Formatted Address"},"line1":{"type":"string","title":"Line1"},"line2":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Line2"},"city":{"type":"string","title":"City"},"state":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"State"},"postal_code":{"type":"string","title":"Postal Code"},"country":{"type":"string","title":"Country"},"country_code":{"type":"string","title":"Country Code"},"latitude":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Latitude"},"longitude":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Longitude"},"is_deliverable":{"type":"boolean","title":"Is Deliverable","default":true}},"type":"object","required":["id","formatted_address","line1","city","postal_code","country","country_code"],"title":"AddressResponse","description":"Address resource response."},"ApiKeyResponse":{"properties":{"api_key":{"type":"string","title":"Api Key"},"key_prefix":{"type":"string","title":"Key Prefix"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["api_key","key_prefix","created_at"],"title":"ApiKeyResponse","description":"Response for API key generation."},"ApplyCodeBody":{"properties":{"code":{"type":"string","minLength":1,"title":"Code","description":"Code text to apply"}},"type":"object","required":["code"],"title":"ApplyCodeBody","description":"Request body for applying a code to an order."},"ApplyCodeResponse":{"properties":{"status":{"type":"string","title":"Status"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"},"discount_cash_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Discount Cash Cents"},"payable_cash_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Payable Cash Cents"},"spent_product_units":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Spent Product Units"},"spent_credit_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Spent Credit Cents"},"spent_cash_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Spent Cash Cents"},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"}},"type":"object","required":["status"],"title":"ApplyCodeResponse","description":"Response for applying a code."},"AssetResponse":{"properties":{"id":{"type":"string","title":"Id"},"url":{"type":"string","title":"Url"},"mime_type":{"type":"string","title":"Mime Type"},"original_filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Original Filename"},"asset_type":{"type":"string","title":"Asset Type"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","url","mime_type","asset_type","created_at"],"title":"AssetResponse","description":"Asset resource response."},"Body_upload_asset_api_v1_assets__post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","required":["file"],"title":"Body_upload_asset_api_v1_assets__post"},"CodeCreate":{"properties":{"code":{"type":"string","title":"Code","description":"Human-readable code text"},"owner_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Owner Id"},"starts_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Starts At"},"ends_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Ends At"},"new_users_only":{"type":"boolean","title":"New Users Only","default":false},"order_max_total_uses":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Order Max Total Uses"},"order_max_uses_per_user":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Order Max Uses Per User"},"order_max_unique_users":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Order Max Unique Users"},"owner_max_total_payout_uses":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Owner Max Total Payout Uses"},"owner_max_payout_uses_per_user":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Owner Max Payout Uses Per User"},"owner_max_unique_users":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Owner Max Unique Users"},"redeemer_type":{"type":"string","title":"Redeemer Type","default":"none"},"redeemer_currency":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Redeemer Currency"},"redeemer_value":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Redeemer Value"},"owner_type":{"type":"string","title":"Owner Type","default":"none"},"owner_currency":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Owner Currency"},"owner_value":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Owner Value"},"status":{"type":"string","title":"Status","default":"active"},"metadata_json":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata Json"}},"type":"object","required":["code"],"title":"CodeCreate"},"CodeListResponse":{"properties":{"codes":{"items":{"$ref":"#/components/schemas/CodeResponse"},"type":"array","title":"Codes"}},"type":"object","required":["codes"],"title":"CodeListResponse"},"CodeResponse":{"properties":{"id":{"type":"string","title":"Id"},"code":{"type":"string","title":"Code"},"owner_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Owner Id"},"starts_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Starts At"},"ends_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Ends At"},"new_users_only":{"type":"boolean","title":"New Users Only"},"order_max_total_uses":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Order Max Total Uses"},"order_max_uses_per_user":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Order Max Uses Per User"},"order_max_unique_users":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Order Max Unique Users"},"owner_max_total_payout_uses":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Owner Max Total Payout Uses"},"owner_max_payout_uses_per_user":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Owner Max Payout Uses Per User"},"owner_max_unique_users":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Owner Max Unique Users"},"redeemer_type":{"type":"string","title":"Redeemer Type"},"redeemer_currency":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Redeemer Currency"},"redeemer_value":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Redeemer Value"},"owner_type":{"type":"string","title":"Owner Type"},"owner_currency":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Owner Currency"},"owner_value":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Owner Value"},"status":{"type":"string","title":"Status"},"metadata_json":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata Json"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","code","owner_id","starts_at","ends_at","new_users_only","order_max_total_uses","order_max_uses_per_user","order_max_unique_users","owner_max_total_payout_uses","owner_max_payout_uses_per_user","owner_max_unique_users","redeemer_type","redeemer_currency","redeemer_value","owner_type","owner_currency","owner_value","status","metadata_json","created_at","updated_at"],"title":"CodeResponse"},"CodeUpdate":{"properties":{"starts_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Starts At"},"ends_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Ends At"},"new_users_only":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"New Users Only"},"order_max_total_uses":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Order Max Total Uses"},"order_max_uses_per_user":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Order Max Uses Per User"},"order_max_unique_users":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Order Max Unique Users"},"owner_max_total_payout_uses":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Owner Max Total Payout Uses"},"owner_max_payout_uses_per_user":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Owner Max Payout Uses Per User"},"owner_max_unique_users":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Owner Max Unique Users"},"redeemer_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Redeemer Type"},"redeemer_currency":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Redeemer Currency"},"redeemer_value":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Redeemer Value"},"owner_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Owner Type"},"owner_currency":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Owner Currency"},"owner_value":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Owner Value"},"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"},"metadata_json":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata Json"}},"type":"object","title":"CodeUpdate"},"CreateOrderBody":{"properties":{"user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id","description":"User ID (admin only, defaults to current user)"}},"type":"object","title":"CreateOrderBody","description":"Request body for creating an order."},"FulfillmentInfo":{"properties":{"status":{"type":"string","title":"Status"},"prodigi_order_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Prodigi Order Id"},"tracking_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tracking Number"},"tracking_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tracking Url"},"carrier":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Carrier"}},"type":"object","required":["status"],"title":"FulfillmentInfo","description":"Fulfillment status info embedded in order."},"FulfillmentSubmitResponse":{"properties":{"order_id":{"type":"string","title":"Order Id"},"provider":{"type":"string","title":"Provider"},"external_id":{"type":"string","title":"External Id"},"status":{"type":"string","title":"Status"}},"type":"object","required":["order_id","provider","external_id","status"],"title":"FulfillmentSubmitResponse","description":"Response for submitting an order to a fulfillment provider."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"KapsoWebhookResponse":{"properties":{"status":{"type":"string","title":"Status"},"message_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message Id"},"user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"},"event":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Event"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"},"direction":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Direction"},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"}},"type":"object","required":["status"],"title":"KapsoWebhookResponse","description":"Response for Kapso webhook processing."},"LedgerListResponse":{"properties":{"transactions":{"items":{"$ref":"#/components/schemas/LedgerTransactionResponse"},"type":"array","title":"Transactions"}},"type":"object","required":["transactions"],"title":"LedgerListResponse"},"LedgerTransactionResponse":{"properties":{"id":{"type":"string","title":"Id"},"order_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Order Id"},"user_id":{"type":"string","title":"User Id"},"code_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code Id"},"entry_type":{"type":"string","title":"Entry Type"},"currency":{"type":"string","title":"Currency"},"amount":{"type":"number","title":"Amount"},"reason":{"type":"string","title":"Reason"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","order_id","user_id","code_id","entry_type","currency","amount","reason","created_at"],"title":"LedgerTransactionResponse"},"LobWebhookResponse":{"properties":{"status":{"type":"string","title":"Status"},"event":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Event"},"order_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Order Id"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"}},"type":"object","required":["status"],"title":"LobWebhookResponse","description":"Response for Lob webhook processing."},"OrderListResponse":{"properties":{"orders":{"items":{"$ref":"#/components/schemas/OrderSummaryResponse"},"type":"array","title":"Orders"}},"type":"object","required":["orders"],"title":"OrderListResponse","description":"Response for order listing."},"OrderResponse":{"properties":{"id":{"type":"string","title":"Id"},"user_id":{"type":"string","title":"User Id"},"status":{"type":"string","title":"Status"},"slots":{"items":{"$ref":"#/components/schemas/SlotValueResponse"},"type":"array","title":"Slots"},"preview_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Preview Url"},"checkout_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checkout Url"},"payment":{"anyOf":[{"$ref":"#/components/schemas/PaymentInfo"},{"type":"null"}]},"fulfillment":{"anyOf":[{"$ref":"#/components/schemas/FulfillmentInfo"},{"type":"null"}]},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","user_id","status","slots","created_at","updated_at"],"title":"OrderResponse","description":"Full order resource response."},"OrderSummaryResponse":{"properties":{"id":{"type":"string","title":"Id"},"user_id":{"type":"string","title":"User Id"},"status":{"type":"string","title":"Status"},"preview_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Preview Url"},"checkout_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checkout Url"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","user_id","status","created_at","updated_at"],"title":"OrderSummaryResponse","description":"Order summary for list views."},"OtpRequestBody":{"properties":{"phone_number":{"type":"string","title":"Phone Number","description":"Phone number in E.164 format (e.g., +31612345678)"}},"type":"object","required":["phone_number"],"title":"OtpRequestBody","description":"Request body for OTP request."},"PaymentInfo":{"properties":{"status":{"type":"string","title":"Status"},"amount":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Amount"},"currency":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Currency"}},"type":"object","required":["status"],"title":"PaymentInfo","description":"Payment status info embedded in order."},"PaymentSyncResponse":{"properties":{"order_id":{"type":"string","title":"Order Id"},"payment_status":{"type":"string","title":"Payment Status"},"order_status":{"type":"string","title":"Order Status"}},"type":"object","required":["order_id","payment_status","order_status"],"title":"PaymentSyncResponse","description":"Response for payment sync."},"ProdigiWebhookResponse":{"properties":{"status":{"type":"string","title":"Status"},"event":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Event"},"order_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Order Id"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"}},"type":"object","required":["status"],"title":"ProdigiWebhookResponse","description":"Response for Prodigi webhook processing."},"RecipientListResponse":{"properties":{"recipients":{"items":{"$ref":"#/components/schemas/RecipientResponse"},"type":"array","title":"Recipients"}},"type":"object","required":["recipients"],"title":"RecipientListResponse","description":"Response for recipient listing."},"RecipientResponse":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"address":{"anyOf":[{"$ref":"#/components/schemas/AddressResponse"},{"type":"null"}]},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","name","created_at"],"title":"RecipientResponse","description":"Recipient resource response."},"RedemptionListResponse":{"properties":{"redemptions":{"items":{"$ref":"#/components/schemas/RedemptionResponse"},"type":"array","title":"Redemptions"}},"type":"object","required":["redemptions"],"title":"RedemptionListResponse"},"RedemptionResponse":{"properties":{"id":{"type":"string","title":"Id"},"code_id":{"type":"string","title":"Code Id"},"user_id":{"type":"string","title":"User Id"},"order_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Order Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"first_applied_at":{"type":"string","format":"date-time","title":"First Applied At"},"last_applied_at":{"type":"string","format":"date-time","title":"Last Applied At"},"apply_count":{"type":"integer","title":"Apply Count"}},"type":"object","required":["id","code_id","user_id","order_id","created_at","first_applied_at","last_applied_at","apply_count"],"title":"RedemptionResponse"},"SendMessageRequest":{"properties":{"message":{"type":"string","title":"Message"},"direction":{"type":"string","title":"Direction"}},"type":"object","required":["message","direction"],"title":"SendMessageRequest","description":"Request body for sending a message to a user."},"SendMessageResponse":{"properties":{"status":{"type":"string","title":"Status"},"direction":{"type":"string","title":"Direction"},"response":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Response"}},"type":"object","required":["status","direction"],"title":"SendMessageResponse","description":"Response for POST /users/{user_id}/messages."},"SlotUpdateItem":{"properties":{"slot_name":{"type":"string","title":"Slot Name"},"value":{"title":"Value"}},"type":"object","required":["slot_name","value"],"title":"SlotUpdateItem","description":"Single slot update in a batch."},"SlotValueResponse":{"properties":{"slot_name":{"type":"string","title":"Slot Name"},"value":{"anyOf":[{},{"type":"null"}],"title":"Value"},"confirmed":{"type":"boolean","title":"Confirmed","default":false},"confidence":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Confidence"},"source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source"},"updated_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updated At"}},"type":"object","required":["slot_name"],"title":"SlotValueResponse","description":"Slot value with metadata."},"StripeWebhookResponse":{"properties":{"status":{"type":"string","title":"Status","default":"received"},"event":{"type":"string","title":"Event"},"order_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Order Id"}},"type":"object","required":["event"],"title":"StripeWebhookResponse","description":"Response for Stripe webhook processing."},"UpdateOrderBody":{"properties":{"status":{"type":"string","title":"Status","description":"New status (currently only 'draft' supported)"}},"type":"object","required":["status"],"title":"UpdateOrderBody","description":"Request body for updating order (e.g., unlock to DRAFT)."},"UpdateSlotsBody":{"properties":{"slots":{"items":{"$ref":"#/components/schemas/SlotUpdateItem"},"type":"array","title":"Slots"}},"type":"object","required":["slots"],"title":"UpdateSlotsBody","description":"Request body for updating order slots."},"UpdateSlotsResponse":{"properties":{"status":{"type":"string","title":"Status","default":"success"},"updated_slots":{"items":{"type":"string"},"type":"array","title":"Updated Slots"},"missing_slots":{"items":{"type":"string"},"type":"array","title":"Missing Slots"}},"type":"object","required":["updated_slots","missing_slots"],"title":"UpdateSlotsResponse","description":"Response for slot update."},"UserBalanceResponse":{"properties":{"user_id":{"type":"string","title":"User Id"},"balances":{"additionalProperties":{"type":"number"},"type":"object","title":"Balances"}},"type":"object","required":["user_id","balances"],"title":"UserBalanceResponse"},"UserListResponse":{"properties":{"users":{"items":{"$ref":"#/components/schemas/UserResponse"},"type":"array","title":"Users"}},"type":"object","required":["users"],"title":"UserListResponse","description":"Response for user listing."},"UserResponse":{"properties":{"id":{"type":"string","title":"Id"},"phone_number":{"type":"string","title":"Phone Number"},"display_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Display Name"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","phone_number","created_at","updated_at"],"title":"UserResponse","description":"User resource response."},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"VerifyOtpBody":{"properties":{"phone_number":{"type":"string","title":"Phone Number","description":"Phone number in E.164 format"},"code":{"type":"string","maxLength":6,"minLength":6,"title":"Code","description":"6-digit OTP code"}},"type":"object","required":["phone_number","code"],"title":"VerifyOtpBody","description":"Request body for OTP verification."},"VerifyOtpResponse":{"properties":{"api_key":{"type":"string","title":"Api Key","description":"API key (shown once, store securely)"},"user_id":{"type":"string","title":"User Id"}},"type":"object","required":["api_key","user_id"],"title":"VerifyOtpResponse","description":"Response for successful OTP verification."}},"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer"}}}}