LogoLogo
  • LiquidCommerce Documentation
  • πŸ”Authentication API Integration
    • Get Access Token
  • Services
    • πŸ—ΊοΈAddress API
      • Autocomplete
      • Details
    • πŸ‘₯Users API
      • Session
      • Fetch User
      • Delete User
      • Create/Update Address
      • Delete Address
      • Add Payment
      • Update Default Payment
      • Delete Payment
    • πŸ—ƒοΈCatalog API
      • Search
      • Availability
    • πŸ›’Cart API
      • Create/Update Cart
    • πŸ›οΈCheckout API
      • Prepare
      • Complete
    • πŸ“Orders API
      • Authentication
      • Get Order
  • CLOUD SDK
    • Overview
    • Methods & Usage
  • EVENTS & ERRORS
    • Overview
    • Cart Events
    • Checkout Status Codes
  • EVENT BRIDGE (WEBHOOKS)
    • Orders
  • Types
    • Loc
    • Catalog
    • Catalog Filters
    • Product
    • Cart
    • User
    • Retailer
    • Checkout
    • Order
Powered by GitBook
On this page
  • Endpoint Details
  • Headers
  • Response Details
  • Sample Request and Response
  • Using the Access Token
  • Access Token Refresh
  • Error Handling
  • Rate Limiting
  • Best Practices
Export as PDF
  1. Authentication API Integration

Get Access Token

Use this endpoint with your API key to get an access token, which is essential for authenticating other API requests.

PreviousAuthentication API IntegrationNextAddress API

Last updated 6 months ago

Endpoint Details

GET /authentication

If you need assistance on obtaining your API key, contact support

Headers

Header
Value

Content-Type

application/json

X-LIQUID-API-KEY

<YOUR_API_KEY>

Response Details

Field
Type
Description

statusCode

number

Internal status code of the response

message

string

A brief message describing the result of the API call

metadata

Contains metadata about the API call

data

Authentication object

Metadata Object

Auth Object

Field
Type
Description

token

string

The access token to be used for other API calls

type

string enum

The type of token, always "ACCESS_TOKEN"

exp

number

The expiration timestamp of the token (1 day)

Sample Request and Response

curl --location 'https://api.liquidcommerce.cloud/authentication'
{
    "statusCode": 200,
    "message": "OK",
    "metadata": {
        "languages": [
            "en"
        ],
        "timestamp": 1731590739955,
        "timezone": "UTC",
        "requestId": "reqid_123abc45def",
        "path": "/api/authentication",
        "version": "1.7.0"
    },
    "data": {
        "token": "<YOUR_ACCESS_TOKEN>",
        "type": "ACCESS_TOKEN",
        "exp": 1731674132795
    }
}
{
    "statusCode": 5000,
    "message": "API Key not found",
    "metadata": {
        "languages": [
            "en"
        ],
        "timestamp": 1731592190265,
        "timezone": "UTC",
        "requestId": "reqid_123abc45def",
        "path": "/api/authentication",
        "version": "1.7.0"
    },
    "errors": []
}

Using the Access Token

After obtaining the access token, include it in the Authorization header on any API calls to LiquidCommerce API Services.

Authorization: Bearer <YOUR_ACCESS_TOKEN>

Access Token Refresh

All API endpoints that require authentication now support token refreshing. This is done by including a refresh parameter in the request body.

Request Body Parameter

Parameter
Type
Description

refresh

boolean

When set to true, a new access token will be generated and returned

Response

When refresh is set to true, the API response will include an auth object containing the new access token information.

{
    "auth": {
        "token": "<NEW_ACCESS_TOKEN>",
        "type": "ACCESS_TOKEN",
        "exp": 1722920383204
    },
    // ... other response data
}

Error Handling

The API uses standard HTTP response codes to indicate the success or failure of requests. In case of an error, the response body will contain a JSON object with more details about the error.

Rate Limiting

The Authentication API is subject to rate limiting to ensure fair usage and maintain performance. If you exceed the rate limit, you'll receive a 429 (Too Many Requests) response.

Best Practices

  • Store the access token securely on the client-side.

  • Include the refresh parameter when making requests close to the token's expiration time.

  • Update the stored access token whenever a new one is received in the auth object of a response.

  • Implement proper error handling for cases where token refresh fails.

πŸ”
metaDataObject
authObject
Field
Type
Description

languages

Array<string>

List of supported languages for the response, e.g. ["en"]

timestamp

string

Unix timestamp (in milliseconds) when the response was generated

timezone

string

Timezone used for the response, always "UTC"

requestId

string

Unique identifier for the API request. Used for debugging and support

path

string

API path

version

string

API version used for the request

Support

Our dedicated support team is available to assist you with API integration and usage. For any questions or issues, please contact solutions@liquidapp.co.