New
Mar 18, 2025
AI Commerce provides a GraphQL API that enables a flexible and efficient way to query data from the platform. GraphQL is particularly useful because it allows partners the freedom to define exactly what data they need, which reduces unnecessary data transfer and speeds up request processing.
How does GraphQL work in the AI Commerce environment?
AI Commerce uses the Apollo GraphQL server, which receives requests and returns only the requested data. Partners can use GraphQL to retrieve products, countries, and other information from the AI Commerce platform. GraphQL requests are made via HTTP POST requests and require the correct credentials in the header field.
Making a GraphQL request
GraphQL requests are made in JSON format using the load balancer address obtained from the environment variable APP_LOAD_BALANCER_URL
. For example, you can retrieve five products as follows:
Required headers
Each GraphQL request requires the following headers:
X-GraphQL-Secret
: AI Commerce security key.X-Tenant-Id
: Store alias.X-Tenant-Secret
: Tenant API key.Content-Type
:application/json
.
Summary
GraphQL is an effective and flexible way to query information from the AI Commerce platform. We recommend using AI Commerce's Lambda load balancer to enhance security.
For more information about the GraphQL API, you can find detailed documentation in our knowledge base.