API ReferenceEndpointsPublic API (v1)Set customer info on checkout

Set customer info on checkout

Supports Idempotency-Key header for safe retries.

PATCH
/v1/checkout/{checkoutId}/customer
AuthorizationBearer <token>

Admin API key (server-to-server). Issue via the dashboard at Settings → API keys. Plain-text key is shown once — store in a secret manager. Format: Authorization: Bearer brainerce_xxxxxxxxx.

In: header

Path Parameters

checkoutIdstring

Checkout ID

Header Parameters

Idempotency-Key?string

Client-supplied key (a UUID v4 is the recommended form, max 255 characters) that makes this mutation safe to retry.

  • Replay window: 24 hours. The first response for a key is cached; a retry inside the window with the same request body returns the original status and body without re-running the handler.
  • Reusing a key with a different body returns 409 Conflict with code: "IDEMPOTENCY_KEY_REUSED". The request fingerprint (method + path + body hash) is compared against the stored one; a mismatch is refused rather than served the old response.
  • Keys are scoped to the calling credential and store — two API keys may safely use the same key value.
  • Error responses are cached too, so a retry of a request that failed validation returns the same 400 immediately.
  • Sending this header on a GET returns 400 with code: "IDEMPOTENCY_KEY_NOT_SUPPORTED" — GETs are already idempotent.
  • Support is per-route and this parameter is the authoritative signal: a key sent to a route that does not declare it is accepted and silently ignored.

See /docs/api/idempotency.

Lengthlength <= 255
emailstring

Shopper email address. Used for order confirmation, abandoned-checkout recovery, and matching/creating the customer record.

Formatemail
firstName?string

Shopper first name. Optional at this step, but required later if no shipping address is set.

lastName?string

Shopper last name. Optional at this step, but required later if no shipping address is set.

phone?string

Shopper phone number in E.164 format.

acceptsMarketing?boolean

Whether the shopper opted in to marketing communications. When true, the customer record is flagged for marketing email/SMS lists.

notes?string

Order-level note from the shopper ("Please leave at the door"). Stored on the cart and copied onto the order at completion, then shown to the merchant in the dashboard and included in the confirmation email. Max 2000 chars. Send an empty string to clear a previously-set note.

Lengthlength <= 2000
analyticsClientId?string

GA4 gtag.js client_id (from gtag('get', measurementId, 'client_id', cb)), forwarded so the server-side purchase event can stitch to this browser session. Written onto the cart if not already set. Omit if unavailable, and never send a synthesized id.

Lengthlength <= 100
analyticsSessionId?string

GA4 gtag.js session_id (from gtag('get', measurementId, 'session_id', cb)), forwarded alongside analyticsClientId for the same stitch.

Lengthlength <= 100
trafficReferrerHost?string

Hostname of the external referrer that brought this shopper (last non-direct touch), auto-attached by the storefront SDK from its brainerce_attr capture. Raw host on purpose, because the platform classifies it (AI/organic/social) at read time. Omit if unknown.

Lengthlength <= 253
trafficUtmSource?string

utm_source of the last non-direct touch, auto-attached alongside trafficReferrerHost.

Lengthlength <= 150
trafficUtmMedium?string

utm_medium of the last non-direct touch.

Lengthlength <= 150
trafficUtmCampaign?string

utm_campaign of the last non-direct touch.

Lengthlength <= 150
trafficUtmTerm?string

utm_term of the last non-direct touch.

Lengthlength <= 150
trafficUtmContent?string

utm_content of the last non-direct touch.

Lengthlength <= 150
trafficGclid?string

Google Ads click id (gclid query param), auto-attached by the storefront SDK. Write-only: never returned from a public GET. Omit if the visit was not Ads-tagged.

Lengthlength <= 128
trafficGbraid?string

Google Ads app/cross-device click id (gbraid query param). Write-only: never returned from a public GET.

Lengthlength <= 128
trafficWbraid?string

Google Ads web-to-app click id (wbraid query param). Write-only: never returned from a public GET.

Lengthlength <= 128
trafficLandingPath?string

Path (never the query string) of the page that first captured this attribution snapshot.

Lengthlength <= 300
trafficCapturedAt?string

ISO 8601 timestamp of when the SDK captured this attribution snapshot client-side.

consentVersion?string

Which consent regime (e.g. Consent Mode v2) was active when the SDK captured this snapshot.

Lengthlength <= 40
analyticsConsentGranted?boolean

Consent Mode analytics_storage consent state captured client-side (client.updateConsent({analytics})), forwarded like the traffic-attribution fields above. Omit when no consent signal has been captured yet — that is NOT the same as false, and must not be inferred. Gates server-side GA4 sends only — see adsUserDataConsentGranted for the separate ad_user_data purpose.

adsUserDataConsentGranted?boolean

Consent Mode ad_user_data/ad_personalization consent state captured client-side (client.updateConsent({ads})), forwarded independently from analyticsConsentGranted above. Omit when no consent signal has been captured yet — that is NOT the same as false, and must not be inferred. This is the legal basis Google Ads Enhanced Conversions requires before hashed email/phone can be uploaded; never gate that upload on analyticsConsentGranted instead.

curl -X PATCH "https://api.brainerce.com/api/v1/checkout/string/customer" \  -H "Idempotency-Key: string" \  -H "Content-Type: application/json" \  -d '{    "email": "[email protected]"  }'
{
  "id": "clx1a2b3c4d5e6f7g8h9",
  "status": "PENDING",
  "email": "[email protected]",
  "customerId": "clx1a2b3c4d5e6f7g8h9",
  "deliveryType": "shipping",
  "pickupLocation": {
    "id": "clx1a2b3c4d5e6f7g8h9",
    "name": "Main store",
    "rateName": "Store pickup",
    "address": {
      "line1": "Herzl 12",
      "line2": "Apt 4",
      "city": "Tel Aviv",
      "region": "Center District",
      "postalCode": "6578301",
      "country": "IL"
    },
    "phone": "+972501234567",
    "hours": "Sun-Thu 09:00-18:00",
    "instructions": "Bring your order number",
    "price": "0.00",
    "currency": "USD"
  },
  "shippingAddress": {
    "firstName": "Dana",
    "lastName": "Cohen",
    "company": "Acme Ltd",
    "line1": "Herzl 12",
    "line2": "Apt 4",
    "city": "Tel Aviv",
    "region": "Center District",
    "postalCode": "6578301",
    "country": "IL",
    "phone": "+972501234567"
  },
  "billingAddress": {
    "firstName": "Dana",
    "lastName": "Cohen",
    "company": "Acme Ltd",
    "line1": "Herzl 12",
    "line2": "Apt 4",
    "city": "Tel Aviv",
    "region": "Center District",
    "postalCode": "6578301",
    "country": "IL",
    "phone": "+972501234567"
  },
  "shippingRateId": "clx1a2b3c4d5e6f7g8h9",
  "shippingMethod": {
    "id": "clx1a2b3c4d5e6f7g8h9",
    "name": "Standard shipping",
    "description": "Delivery in 3 to 5 business days",
    "price": "15.00",
    "currency": "USD",
    "estimatedDays": 4,
    "source": "manual",
    "carrier": "ups",
    "service": "ground",
    "speedTier": "cheapest",
    "requiresPickupPoint": true
  },
  "currency": "USD",
  "subtotal": "59.80",
  "discountAmount": "5.00",
  "ruleDiscountAmount": "5.00",
  "appliedRules": [
    {
      "id": "clx1a2b3c4d5e6f7g8h9",
      "name": "Summer sale",
      "type": "ORDER_DISCOUNT",
      "discountAmount": "10.00"
    }
  ],
  "shippingAmount": "15.00",
  "taxAmount": "11.46",
  "taxBreakdown": {
    "subtotal": 50.9,
    "shippingNet": 12.71,
    "totalTax": 11.46,
    "total": 75.1,
    "breakdown": [
      {
        "name": "VAT",
        "rate": 18,
        "amount": 9.17
      }
    ],
    "currency": "USD"
  },
  "total": "81.26",
  "surchargeAmount": "0.00",
  "appliedSurcharges": [
    {
      "key": "handling",
      "name": "Handling fee",
      "value": "string",
      "amount": "5.00"
    }
  ],
  "customFieldValues": {},
  "couponCode": "WELCOME10",
  "tenders": [
    {
      "tenderId": "clx1a2b3c4d5e6f7g8h9",
      "amountApplied": "50.00"
    }
  ],
  "providerAmountDue": "81.26",
  "notes": "Leave at the door",
  "lineItems": [
    {
      "id": "clx1a2b3c4d5e6f7g8h9",
      "productId": "clx1a2b3c4d5e6f7g8h9",
      "variantId": "clx1a2b3c4d5e6f7g8h9",
      "quantity": 2,
      "unitPrice": "29.90",
      "discountAmount": "0.00",
      "product": {
        "id": "clx1a2b3c4d5e6f7g8h9",
        "name": "Classic T-Shirt",
        "sku": "TSHIRT-BLK-M",
        "images": [
          {}
        ],
        "isDownloadable": true
      },
      "variant": {
        "id": "clx1a2b3c4d5e6f7g8h9",
        "name": "Black / M",
        "sku": "TSHIRT-BLK-M"
      },
      "notes": "Gift wrap please",
      "metadata": {},
      "customizations": {}
    }
  ],
  "itemCount": 2,
  "availableShippingRates": [
    {
      "id": "clx1a2b3c4d5e6f7g8h9",
      "name": "Standard shipping",
      "description": "Delivery in 3 to 5 business days",
      "price": "15.00",
      "currency": "USD",
      "estimatedDays": 4,
      "source": "manual",
      "carrier": "ups",
      "service": "ground",
      "speedTier": "cheapest",
      "requiresPickupPoint": true
    }
  ],
  "expiresAt": "2019-08-24T14:15:22Z",
  "recoveryEmailSentAt": "2019-08-24T14:15:22Z",
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z",
  "reservation": {
    "hasReservation": true,
    "expiresAt": "2019-08-24T14:15:22Z",
    "remainingSeconds": 540,
    "strategy": "ON_PAYMENT",
    "countdownMessage": "Your items are reserved for 9 minutes"
  },
  "presentment": {
    "currency": "USD",
    "subtotal": "59.80",
    "discountAmount": "0.00",
    "shippingAmount": "15.00",
    "taxAmount": "11.46",
    "surchargeAmount": "0.00",
    "total": "86.26",
    "fxChargingRate": "3.65",
    "fxBufferPercent": "2.00"
  },
  "pickupPoint": {
    "id": "pp_48213",
    "name": "Kiosk Herzl",
    "kind": "store",
    "address": {
      "street1": "Herzl 12",
      "city": "Tel Aviv",
      "zip": "6578301",
      "country": "IL"
    },
    "latitude": 32.0668,
    "longitude": 34.7647,
    "hours": "Sun-Thu 08:00-20:00",
    "note": "Next to the pharmacy",
    "distanceKm": 0.8
  },
  "totalAmount": "81.26"
}

{
  "statusCode": 400,
  "code": "VALIDATION_FAILED",
  "message": "name should not be empty, price must be a positive number",
  "timestamp": "2026-08-23T10:15:00.000Z",
  "path": "/api/v1/checkout/{checkoutId}/customer"
}

{
  "statusCode": 401,
  "code": "UNAUTHORIZED",
  "message": "Invalid or expired credential",
  "timestamp": "2026-08-23T10:15:00.000Z",
  "path": "/api/v1/checkout/{checkoutId}/customer"
}

{
  "statusCode": 403,
  "code": "INSUFFICIENT_SCOPE",
  "message": "API key does not have the required scope: products:write",
  "timestamp": "2026-08-23T10:15:00.000Z",
  "path": "/api/v1/checkout/{checkoutId}/customer"
}

{
  "statusCode": 404,
  "code": "RESOURCE_NOT_FOUND",
  "message": "Resource not found",
  "timestamp": "2026-08-23T10:15:00.000Z",
  "path": "/api/v1/checkout/{checkoutId}/customer"
}

{
  "statusCode": 429,
  "code": "RATE_LIMITED",
  "message": "Too many requests",
  "details": {
    "retryAfterSeconds": 12
  },
  "timestamp": "2026-08-23T10:15:00.000Z",
  "path": "/api/v1/store"
}