Skip to content
English
  • There are no suggestions because the search field is empty.

Agent API: Partner Integration Guide (V1)

The Agent API allows a partner's customer-care chatbot to manage subscriptions, issue courtesy coupons, and review customer interaction histories on behalf of authenticated mobile app customers.


1 Overview & Authentication

All Agent API operations execute in the context of an authenticated customer session. No device ID is required. Authorization is strictly bound to the authenticated customer behind the session, never on customer identifiers supplied in the request.

Every request carries the X-Customer-Api-Key, X-Liquid-Timestamp and X-Liquid-Signature headers (see Request headers and signature on the API reference). The timestamp must be within ±10 minutes of server time. All endpoints except sign-in and audit events also require Authorization: Bearer <accessToken>.

Signature: Concatenate, with no separators and each part trimmed, the timestamp, then any values the operation lists, then the signature salt. UTF-8 encode the string, hash it with SHA-256 and send the digest as lowercase hex in X-Liquid-Signature. The signature salt is a separate secret supplied by Liquid Barcodes and is not the same value as X-Customer-Api-Key. Neither the API key nor the Bearer token is part of the signed string. Operation-specific signed values:

  • PUT /v1/user/default-payment-method: defaultPaymentMethodId as a string (digits only).
  • GET /v1/audit-events: userId, phone, limit (empty string for any value not sent).
  • PUT /v1/user/emails, PUT /v1/user/preferred-stores, PUT /v1/user/external-identifiers: timestamp and signature salt only; no body fields are signed.

1.1 Authentication Methods

A customer session can be established through two methods:

  • In-App SSO Handoff: POST /v1/auth/sso with body { "ssoToken": "…" } validates the customer's app Single Sign-On (SSO) token and creates an active session. ssoToken is letters and digits only, up to 64 characters.
  • Web Phone + OTP: POST /v1/auth/otp/start with body { "phone": "4791234567" } sends a one-time PIN (OTP) to the customer's mobile phone number and returns { "phone": "4791234567" }. POST /v1/auth/otp/verify with body { "phone": "4791234567", "code": "1234" } validates the PIN and establishes an active session. phone is digits only (no + or spaces), 7–13 digits including the country code; code is digits only, 4–8 digits.
  • Session Response: Both SSO and OTP verify return { "accessToken": "…", "expiresInSeconds": 3600}. Send accessToken as Authorization: Bearer <accessToken> on subsequent requests.

To prevent account enumeration, authentication failures are intentionally generic:

  • otp/start returns the same 200 OK response whether a phone number is registered, blocked, or rate-limited.
  • Verification and SSO handoff failures return a generic AuthenticationFailed error.
  • Malformed input (e.g. non-digit characters in phone) returns 400 InvalidInput (1001).

1.2 Session Lifecycle

  • Session Expiry: An active session lasts 1 hour (3600 seconds) from sign-in. A successful sign-in response includes expiresInSeconds. The lifetime is fixed; using the session does not extend it.
  • Re-authentication: There is no token refresh endpoint. A request with an expired or unknown session returns 401 AuthenticationFailed (1002), in rare cases 401 SessionInvalid (1004). On either code from an authenticated endpoint, the chatbot must re-authenticate the customer once to obtain a new session, then retry.

1.3 Permission Scopes

Some operations require a scope that Liquid Barcodes enables for the integration. A session without the required scope receives 403 InsufficientScope (1005).

Scope Operations
user-devices:read GET /v1/user/devices/limit
user-devices:write POST /v1/user/devices/clear
coupon:issue GET /v1/coupons/eligibility, POST /v1/coupons/issue

2 Error Format & Error Codes

2.1 RFC 9110 Problem Details

All error responses conform to RFC 9110 Problem Details and contain: type, title, status, detail, instance, code, numeric errorCode, and traceId.

{
  "type": "https://tools.ietf.org/html/rfc9110#section-15.5.4",
  "title": "Forbidden.",
  "status": 403,
  "detail": "Only the subscription owner can perform this action.",
  "instance": "/v1/subscriptions/cancel",
  "code": "InvalidSubscriptionMemberId",
  "errorCode": 91,
  "traceId": "00-…"
}

📝 Note: Always retain traceId when reporting issues to Liquid Barcodes. The detail field contains generic descriptive text; the chatbot should derive customer-facing messaging from code rather than displaying detail directly.

2.2 Error Codes & Retry Policy

Status Code Error Code Meaning Retry Guidance
400 InvalidInput 1001 Request validation failed Do not retry; correct the request
401 AuthenticationFailed 1002 Authentication failed (generic; covers bootstrap validation failures and expired or unknown sessions) On sign-in, do not retry with the same credentials; on other endpoints, re-authenticate once, then retry
401 InvalidSignature 1003 Request signature invalid, or timestamp outside the ±10 minute window. (INVALID_SIGNATURE in older references represents the same condition) Do not retry; correct the request signature or client clock
401 SessionInvalid 1004 Session missing, expired, or invalid Re-authenticate once to obtain a new session, then retry
403 InsufficientScope 1005 Session lacks permission for the requested operation Do not retry; contact Liquid Barcodes to resolve configuration
409 RequestRejected 1000 Request could not be completed in the current state Do not retry unchanged
409 DuplicateIdempotencyKey 1007 Coupon transactionId already used Do not retry with the same transactionId
502 DependencyError 1008 Downstream service unavailable Check current state via GET /v1/user, then retry if needed
500 UnexpectedError 1009 Internal unexpected failure Check current state via GET /v1/user, then retry if needed
400 InvalidSubscriptionId 89 Subscription ID has an invalid format Do not retry
400 SubscriptionNotFound 90 Subscription not found Do not retry
403 InvalidSubscriptionMemberId 91 Authenticated caller is not the subscription owner Do not retry
409 CouponLimitExceeded 1010 Customer has reached the coupon limit for this schedule Do not retry
409 SubscriptionRebateLimitReached 2001 Customer already received a subscription rebate within the limit period (e.g. 30 days) Do not retry
409 SingleWashCodeNotEligible 2002 Customer already holds the maximum number of active single wash codes Do not retry
409 DeviceClearLimitReached 140 Customer's devices were cleared too many times within the configured window Do not retry now; try again later
409 QuarantinedSubscriptionUsers 126 Family subscription has quarantined members and cannot accept new members right now Do not retry now
400 PlateNumberUpdateLimit 77 Plate number was changed too recently Do not retry now; try again later
400 UserGroupUpdateFailed 44 Group membership change could not be applied Do not retry unchanged

📝 Note: Some reference examples still show legacy upper-case codes (e.g. BOOTSTRAP_VALIDATION_FAILED, INVALID_INPUT, INVALID_SIGNATURE); treat them as equivalent to InvalidInput and InvalidSignature.


3 User & Subscriptions

3.1 Discover Subscriptions (GET /v1/user)

GET /v1/user is the authoritative endpoint for retrieving the authenticated customer's profile and their associated subscriptions.

  • Owner Subscriptions (subscriptions): Subscriptions owned directly by the customer (role = Owner). Only current subscriptions are listed (active, renewing, or awaiting a delayed start).
  • Shared Subscriptions (sharedSubscriptions): Subscriptions accessible via a multi-user/family plan owned by another customer (role = Child). If shared subscriptions temporarily cannot be loaded, an empty array is returned instead of an error; repeat the request before concluding the customer has no shared plan.
  • Role Values (role): Returned as either Owner or Child.
  • Subscription State (subscriptionState): Active, Cancelled, ToActivateWithDelay, or Downgrading.
  • Subscription Model: Contains planName, role, subscriptionId, subscriptionState, renewalState, contentId, isMultiUserPlan, maxUsersAmount, planId, renewalDate, renewalPrice, delayedStartDate, periodBalanceTopUp, rollingAccumulationLimit, rollingAccumulationExpirationPeriodCount, maximumBalanceLimit, currentBalance, and accumulatedBalance.
  • Renewal State (renewalState): SubscriptionStarted, RenewalSucceeded, MonthlyLimitReached (the plan's coupon is used up for the period), RenewingInProgress (up to 3 days, including payment retries), or ToActivateWithDelay.
  • Other Profile Data: GET /v1/user also returns contact and profile fields (userId, msn, name, surname, address fields, emails, dateOfBirth, gender, culture, registrationDate), consents, userGroups, paymentMethods (the first is the default), plateNumber, externalIdentifiers, preferredStores / selectedPreferredStores, referralCode, and ageVerifiedBy.
  • Product Identification: There is no dedicated product-type field. Identify car-wash subscriptions using planId or planName.
  • Subscription ID Stability: subscriptionId remains unchanged across regular billing renewals. However, plan upgrades or downgrades generate a new subscription with a new subscriptionId. Always fetch the current subscriptionId from GET /v1/user rather than persisting it long-term.

Example Response

A customer who owns one plan and shares another (profile fields omitted):

{
  "subscriptions": [
    {
      "planName": "Coffee subscription - Small(S)",
      "role": "Owner",
      "subscriptionId": 79004,
      "subscriptionState": "Active",
      "renewalState": "RenewalSucceeded",
      "contentId": 59086774,
      "isMultiUserPlan": false,
      "maxUsersAmount": 0,
      "planId": 1940,
      "renewalDate": "2026-10-08T03:59:59.0000000+00:00",
      "renewalPrice": 9.99,
      "currentBalance": 0.0
    }
  ],
  "sharedSubscriptions": [
    {
      "planName": "Coffee subscription - Small(S) - Multiuser",
      "role": "Child",
      "subscriptionId": 79403,
      "subscriptionState": "Active",
      "renewalState": "RenewalSucceeded",
      "contentId": 59086771,
      "isMultiUserPlan": true,
      "maxUsersAmount": 3,
      "planId": 1943,
      "renewalDate": "2026-10-08T03:59:59.0000000+00:00",
      "renewalPrice": 29.99,
      "currentBalance": 0.0
    }
  ]
}

4 Subscription Management

4.1 Cancel Subscription (POST /v1/subscriptions/cancel)

Cancels an active subscription owned by the authenticated customer.

Request Body:

{
  "subscriptionId": 79004
}
  • Authorization: Only the plan owner (Owner) can cancel a subscription. Passing a valid subscriptionId as a non-owner (family member or unrelated customer) results in a 403 rejection.
  • Effective Timing: Cancellation normally takes effect at the end of the current billing period (the renewal date). Exceptions:
    • Delayed-start subscriptions that have not yet activated end immediately and are removed from GET /v1/user straight away (they do not appear as Cancelled).
    • Subscriptions currently in the middle of renewing are not renewed; the in-progress renewal is not completed.
  • Post-Cancellation State: Following a successful cancellation, GET /v1/user returns subscriptionState = Cancelled immediately, and renewalDate reflects the end date. renewalState is not changed by cancellation; rely on subscriptionState. Once fully ended, the subscription no longer appears in the list.
  • Cancellation Reason: Not supported in V1; do not supply a reason in the request body.
  • Reactivation: Not available through the Agent API (customers can restart a cancelled plan in the mobile app until the period ends).

Response & Outcomes

Outcome HTTP Status & Response Body Retry Action
Cancelled successfully 200 OK, body {} None
Already cancelled or ended 200 OK, body {} (no state change) None
Invalid subscriptionId (e.g. 0) 400 Bad Request, InvalidInput, error code 1001 Do not retry
Not the plan owner 403 Forbidden, InvalidSubscriptionMemberId, error code 91 Do not retry
Subscription not found 400 Bad Request, SubscriptionNotFound, error code 90 Do not retry
Technical failure 500 (1009) or 502 (1008) Query GET /v1/user first; retry only if status is not Cancelled

⚠️ Retries: There is no idempotency key for cancellations. A repeated cancel request returns 200 OK and does not cancel the subscription twice. After a network timeout, always check the subscription state via GET /v1/user before resending, and do not send parallel cancel requests for the same subscription.

4.2 Family Plan Members

For multi-user (family) plans (isMultiUserPlan = true), the plan owner can view and manage the extra users on the plan. Get subscriptionId from GET /v1/user.

Operation Endpoint Details
List members GET /v1/subscriptions/{subscriptionId}/users Returns subscriptionUsers, each with id (group user record ID) and personalIdentifier (e.g. MSN).
Add member POST /v1/subscriptions/{subscriptionId}/users Body { "personalIdentifier": "1987654123" } identifying an existing user. Returns the new id and personalIdentifier. Returns 409 QuarantinedSubscriptionUsers (126) while the plan has quarantined members.
Remove member DELETE /v1/subscriptions/{subscriptionId}/users/{id} Use the id from the member list. Returns 200 OK with no body.

📝 Note: maxUsersAmount on the subscription shows how many users the plan allows.


5 Customer Audit Trail

5.1 Query Audit Logs (GET /v1/audit-events)

Retrieves the audit trail of Agent API requests performed for a given customer.

  • Authentication: Signed request headers only; no customer session (Authorization) is required. Signed values: userId, phone, limit (raw query-string values, empty when absent).
  • Query Parameters:
    • Exactly one identifier: userId or phone (digits only, same format as sign-in). Passing neither or both returns 400 Bad Request.
    • Optional limit from 1 to 500 (default: 100).
  • Response: Array of events, newest first, each with occurredAt, method, path, statusCode, errorCode (error code string, omitted on success) and userId (when known).
  • Empty Results: Returns [] if no matching records exist.
  • Scope & Privacy: No additional permission scope is required. Each integration can only view its own audit records. Calls to /v1/audit-events itself are not included.
  • Recorded Operations: Every request is logged, including sign-in attempts and rejected operations such as not-owner or not-found.

📝 Note: Audit logging does not backfill historical operations; activity is recorded from the date audit logging was enabled.


6 Courtesy Coupons

6.1 Check Eligibility (GET /v1/coupons/eligibility)

Checks whether a coupon from a schedule can be issued to the authenticated customer, using the same checks as POST /v1/coupons/issue. Use it before offering a courtesy coupon in the conversation.

  • Query Parameter: scheduleId (required, greater than zero).
  • Scope: Requires coupon:issue.
  • Eligible: 200 OK with { "scheduleId": 34897, "eligible": true }. eligible is always true in a successful response.
  • Not Eligible: 409 with a code that depends on how the coupon limit is configured: CouponLimitExceeded (1010, default), SubscriptionRebateLimitReached (2001), SingleWashCodeNotEligible (2002), or RequestRejected (1000) when the configured code is not a known Agent API code.
  • Not Allowed: 403 InsufficientScope when the session lacks the scope or no coupon limit covers the schedule; 400 InvalidInput when the schedule does not exist or belongs to another customer.
  • No Reservation: Nothing is reserved. The checks run again when the coupon is issued, so issuance can still be rejected.

6.2 Issue Coupon (POST /v1/coupons/issue)

Issues a coupon directly to the authenticated customer. The issued coupon appears in the customer's mobile app.

  • Request Body: { "scheduleId": 34897, "expirationDate": "2026-12-31T23:59:59.000Z", "transactionId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890" }
  • Request Parameters: scheduleId (the pre-configured coupon schedule to issue), optional expirationDate (ISO 8601, must be in the future), and required transactionId (client-generated UUID, unique per intended coupon) so that a retried request does not issue a second coupon.
  • Duplicate Protection: A transactionId can be used once per integration within 24 hours. A repeat of a request that succeeded or is still in progress returns 409 DuplicateIdempotencyKey (1007); no second coupon is issued and the original response is not replayed. If the original request failed, the same transactionId can be retried. After a timeout, retry with the same transactionId.
  • Allowed Schedules: Only coupon schedules agreed with and configured by Liquid Barcodes for the integration can be issued; other schedule IDs are rejected with 403 InsufficientScope (1005).
  • Response Body: Returns contentId and scheduleId. The response does not contain the coupon code or expiration date; the customer finds and redeems the coupon in the app.
  • Coupon Not Issued: If the schedule cannot currently issue a coupon (e.g. it is inactive), the request returns 409 RequestRejected (1000).
  • Issuance Limits: Coupon limits are configured per schedule by Liquid Barcodes (for example, one subscription rebate per customer per 30 days, or a maximum number of active single wash codes). A customer over a limit is rejected with the 409 codes listed in 6.1.

7 User Profile Management

All profile operations act on the authenticated customer and return the updated user object (same model as GET /v1/user).

7.1 Update Profile Fields

PATCH /v1/user updates msn, name, surname, address, postCode, city, and plateNumber in one call. Send only the fields to change; an empty string clears a field. plateNumber here is an object: { "id": 0, "plateNumber": "ABC123", "title": "My car" } (use id 0 for a new plate).

The same fields can also be set individually:

Endpoint Body Notes
PATCH /v1/user/name { "name": "…", "surname": "…" } Either or both fields
PATCH /v1/user/address { "address": "…", "postCode": "…", "city": "…" } Any of the address fields
PUT /v1/user/msn { "msn": "1987654321" } Country code + digits, no +
PUT /v1/user/plate-number { "plateNumber": "ABC123" } Returns 400 PlateNumberUpdateLimit (77) if the plate was changed too recently
PUT /v1/user/gender { "gender": "M" } M, F, O, or empty string
PUT /v1/user/culture { "culture": "en-US" } RFC 4646 culture code
PUT /v1/user/date-of-birth { "dateOfBirth": "1990-05-21" } ISO 8601 yyyy-mm-dd
PUT /v1/user/emails { "emails": ["…"] } Replaces the full list
PUT /v1/user/preferred-stores { "selectedPreferredStores": [101, 102] } Store IDs from GET /v1/stores, most preferred first; replaces the list
PUT /v1/user/external-identifiers { "externalIdentifiers": [{ "identifier": "…", "type": "LoyaltyID", "name": "…" }] } Replaces the full list
PUT /v1/user/default-payment-method { "defaultPaymentMethodId": 123 } ID from paymentMethods on the profile; signed value (see 1)

7.2 Consents

  • Approve: POST /v1/user/consents/{consentId}
  • Revoke: DELETE /v1/user/consents/{consentId}
  • consentId is the consent version ID. Consent states on the profile are NoConsent, ConsentGiven, ConsentRevoked, and ConsentRenewalRequired.

7.3 User Groups

  • Join: POST /v1/user/groups/{groupId}. For groups with userConfigurable = CodeConfigurable, send { "userCode": "…" } in the body.
  • Leave: DELETE /v1/user/groups/{groupId}
  • groupId comes from userGroups on the profile. Groups marked NotConfigurable cannot be changed by the customer. A change that cannot be applied returns 400 UserGroupUpdateFailed (44).

8 App Devices

Use these endpoints when a customer cannot log into the app on a new device.

8.1 Check Device Limit (GET /v1/user/devices/limit)

Requires user-devices:read. Returns { "limitReached": true } when the customer has reached the app's device limit and cannot log in on a new device; false when no device limit is configured or it has not been reached.

8.2 Clear Devices (POST /v1/user/devices/clear)

Requires user-devices:write. Removes all of the customer's registered devices so they can log in on a new device.

  • Request Body: { "transactionId": "…" }, a caller-generated unique ID (max 128 characters). Reuse it only when retrying the same request; a retry returns the original result without clearing again.
  • Response: 200 OK with outcome = Cleared or NothingToClear.
  • Rejections (409): DeviceClearLimitReached (140) when devices were cleared too many times within the configured window; DuplicateIdempotencyKey (1007) when a request with the same transactionId is still in progress (retry later); RequestRejected (1000) when another request for the same customer is in progress (retry later).

9 Stores & Receipts

9.1 Stores (GET /v1/stores)

Lists stores; pass optional storeId (Liquid Barcodes internal ID) for a single store. Each store includes id, externalId, name, shortName, address and contact fields, latitude / longitude, currentState (Open, Closed, TemporarilyClosed, PermanentlyClosed), openingHours (Monday to Sunday, H1:M1-H2:M2), and note.

9.2 Machine Status (GET /v1/stores/machines/status)

Returns wash machine status per store. Optional lastUpdateTime (ISO 8601) returns only statuses changed after that time.

  • Store status: Available if any machine is available; OutOfService if every machine is out of service.
  • Machine fields: storeMachineId, name, machineDeviceId, status (Available, OutOfService, Offline), machineProvider, activationTypesAvailable (Code, Trigger), machineType (WashMachine, JetWashMachine, Unknown), and lastUpdateTime.

9.3 Receipts (GET /v1/receipts)

Returns the customer's receipts. Optional storeId limits results to one store and dateFrom (ISO 8601) to receipts from that time forward (e.g. the last 6 months). Each receipt has receiptId, format (e.g. Liquid/1.0) and receipt (the full transaction as escaped JSON).

⚠️ Timeouts: This call can be slow; use generous client timeouts.


10 Rate Limits & Sandbox Testing

10.1 Rate Limits

No rate limits are currently configured for the Agent API, and no 429 Too Many Requests responses are returned. Limits will be defined based on each partner's expected peak and concurrent traffic volumes.

10.2 Sandbox Testing

  • Base URL: https://agent.api.sandbox.eu1.l-b.dev
  • Test Accounts: Liquid Barcodes supplies pre-configured test customers (plan owner, family member, unrelated customer, already-cancelled subscription) with test SSO tokens for automated testing without an SMS PIN. Credentials are shared separately.
  • Subscription Resets: Test subscriptions cancelled during testing are reset manually by Liquid Barcodes on request.
  • Production URL: Provided by Liquid Barcodes for your environment.