For the complete documentation index, see llms.txt. This page is also available as Markdown.

Agentic Logic

Agentic Logic

Manage recommendation rules, drafts, published versions, Sources, placements, assignments, and organization exclusions. Evaluate rules and saved scenarios before use.

Send your customer API key in the intelligems-access-token header. The key selects your organization. Do not send orgId. Agentic Logic must be enabled for that organization; a disabled organization receives 404.

Create a rule, save its draft, validate it, and publish it. Publish and run-gates requests return 202 with a publishJobId. Poll the rule's publish-job endpoint until the job completes. A failed validation can return 200 with valid: false; check the response body before you publish.

All operations share a rate limit per API key: 50 requests initially, refilling 25 requests every 30 seconds. A rate-limited request returns 429. Use the Retry-After and X-RateLimit-* response headers to schedule retries.

List assignments

get
GET /v25-10-beta/agentic-logic/assignments

Lists the organization's placement assignments.

Use the intelligems-access-token header. The token selects the organization; do not send orgId. The organization must have Agentic Logic enabled.

Rate Limit: 50 requests per 30s window, refilling 25 tokens every 30s.

Authorizations
intelligems-access-tokenstringRequired

Intelligems external API access token.

Responses
200

OK

application/json
get/v25-10-beta/agentic-logic/assignments
Request
curl --request GET \
  "https://api.intelligems.io/v25-10-beta/agentic-logic/assignments" \
  --header "intelligems-access-token: YOUR_API_KEY"
{
  "assignments": [
    {
      "id": "text",
      "placementId": "text",
      "ruleId": "text",
      "variationId": "text",
      "experience": {
        "id": "text",
        "name": "text",
        "variationName": "text",
        "category": "experiment",
        "status": "pending",
        "isDeleted": true
      },
      "budgetMs": 1,
      "enabled": true,
      "createdAtTs": 1,
      "lastUpdateTs": 1
    }
  ]
}

Create an assignment

post
POST /v25-10-beta/agentic-logic/assignments

Binds a rule to a placement's global cell.

  • placementId (string UUID, required) — Target placement.

  • ruleId (string UUID, required) — Rule to serve.

  • variationId (null, optional) — Only null or an omitted field is accepted. The global cell serves traffic outside any experiment and every variation that has no enabled cell of its own; variation cells come from saving the experience.

  • enabled (boolean, optional, default true) — An enabled assignment serves traffic.

  • budgetMs (integer, optional, 1–5000) — Per-evaluation time budget. Omit it to use the surface's cap; an explicit budget is still capped by the surface's limit.

  • One global assignment per placement; a taken cell answers 409.

  • A code rule can only be assigned to a placement on one of its targetSurfaces; any other surface answers 409.

  • What the slot does when the rule returns nothing is one of the rule's settings, not the assignment's. Set it on the rule.

  • Enabling a code rule requires a published (active) version.

Use the intelligems-access-token header. The token selects the organization; do not send orgId. The organization must have Agentic Logic enabled.

Rate Limit: 50 requests per 30s window, refilling 25 tokens every 30s.

Authorizations
intelligems-access-tokenstringRequired

Intelligems external API access token.

Body

Assign a rule to a placement as the org's GLOBAL default — the cell with no variation, which serves every variation that has no enabled cell of its own. Variation cells are not writable here: they are derived from the experience save, which owns which rule each variation serves. See AgenticLogicPlacementAssignmentDtoDescriptions.variationId.

placementIdstring · uuidRequired

Placement being filled (uuid).

Pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
variationIdnullOptional

Must be null or omitted — this verb writes the GLOBAL cell only. A non-null variation is refused: variation cells are derived from the experience save, which owns which rule each variation serves.

ruleIdstring · uuidRequired

Rule that fills it (uuid).

Pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
budgetMsinteger · min: 1 · max: 10000Optional

Per-assignment evaluation budget in ms, up to 5000ms. Omit to use the placement surface's cap, which is what serving enforces.

enabledbooleanOptional

Per-assignment pause flag. Defaults to true.

Default: true
Responses
200

OK

application/json
post/v25-10-beta/agentic-logic/assignments
Request
curl --request POST \
  "https://api.intelligems.io/v25-10-beta/agentic-logic/assignments" \
  --header "intelligems-access-token: YOUR_API_KEY" \
  --header "Content-Type: application/json" \
  --data @request.json
{
  "assignment": {
    "id": "text",
    "placementId": "text",
    "ruleId": "text",
    "variationId": "text",
    "experience": {
      "id": "text",
      "name": "text",
      "variationName": "text",
      "category": "experiment",
      "status": "pending",
      "isDeleted": true
    },
    "budgetMs": 1,
    "enabled": true,
    "createdAtTs": 1,
    "lastUpdateTs": 1
  }
}

Delete an assignment

delete
DELETE /v25-10-beta/agentic-logic/assignments/{assignmentId}

Deletes an assignment. The slot stops serving that rule immediately.

Use the intelligems-access-token header. The token selects the organization; do not send orgId. The organization must have Agentic Logic enabled.

Rate Limit: 50 requests per 30s window, refilling 25 tokens every 30s.

Authorizations
intelligems-access-tokenstringRequired

Intelligems external API access token.

Path parameters
assignmentIdstring · uuidRequiredPattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Responses
200

OK

application/json
Responseobject
delete/v25-10-beta/agentic-logic/assignments/{assignmentId}
Request
curl --request DELETE \
  "https://api.intelligems.io/v25-10-beta/agentic-logic/assignments/<assignmentId>" \
  --header "intelligems-access-token: YOUR_API_KEY"
{}

Update an assignment

patch
PATCH /v25-10-beta/agentic-logic/assignments/{assignmentId}

Updates an assignment (rule, enable/disable, budget).

Use the intelligems-access-token header. The token selects the organization; do not send orgId. The organization must have Agentic Logic enabled.

Rate Limit: 50 requests per 30s window, refilling 25 tokens every 30s.

Authorizations
intelligems-access-tokenstringRequired

Intelligems external API access token.

Path parameters
assignmentIdstring · uuidRequiredPattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Body

Update the rule or serving config for one (placement, variation) assignment cell.

ruleIdstring · uuidOptional

Rule the existing assignment cell should serve. Repointing keeps the placement, variation, and serving settings intact.

Pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
budgetMsinteger · min: 1 · max: 10000 · nullableOptional

New per-assignment budget in ms, up to 5000ms, or null to return to the placement surface's cap.

enabledbooleanOptional

Per-assignment pause flag.

Responses
200

OK

application/json
patch/v25-10-beta/agentic-logic/assignments/{assignmentId}
Request
curl --request PATCH \
  "https://api.intelligems.io/v25-10-beta/agentic-logic/assignments/<assignmentId>" \
  --header "intelligems-access-token: YOUR_API_KEY" \
  --header "Content-Type: application/json" \
  --data @request.json
{
  "assignment": {
    "id": "text",
    "placementId": "text",
    "ruleId": "text",
    "variationId": "text",
    "experience": {
      "id": "text",
      "name": "text",
      "variationName": "text",
      "category": "experiment",
      "status": "pending",
      "isDeleted": true
    },
    "budgetMs": 1,
    "enabled": true,
    "createdAtTs": 1,
    "lastUpdateTs": 1
  }
}

Evaluate

post
POST /v25-10-beta/agentic-logic/evaluate

Evaluates the active rule assigned to a placement without changing rule or placement state. It returns evaluation telemetry, and does not record an impression.

Use the intelligems-access-token header. The token selects the organization; do not send orgId. The organization must have Agentic Logic enabled.

Rate Limit: 50 requests per 30s window, refilling 25 tokens every 30s.

Authorizations
intelligems-access-tokenstringRequired

Intelligems external API access token.

Body

Run one evaluation against a supplied request context and return the versioned result envelope. Metered per organization; never recorded as an impression.

slotsNeededinteger · max: 50Required

How many recommendation slots the caller intends to render. Non-negative integer, at most 50. Zero is legal and asks the rule for an empty result; it is not an error.

visitorIdstring · min: 1 · max: 128Optional

Seed for the deterministic shuffle (with the rule version). Omitted = a fresh random id per call. Pass a fixed value to make repeat calls comparable against pinned fixtures; live results still drift with the catalog.

countrystringRequired

ISO 3166-1 alpha-2 country the evaluation should price and read Storefront data for.

Pattern: ^[A-Z]{2}$
variationIdstring · uuid · nullableOptional

Experiment cell to resolve the assignment in. Null or omitted = the placement's global cell. A named variation resolves its own enabled cell when it has one, and otherwise falls back to the global cell — a disabled variation cell does not suppress the global default.

Pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Responses
200

OK

application/json
post/v25-10-beta/agentic-logic/evaluate
Request
curl --request POST \
  "https://api.intelligems.io/v25-10-beta/agentic-logic/evaluate" \
  --header "intelligems-access-token: YOUR_API_KEY" \
  --header "Content-Type: application/json" \
  --data @request.json
{
  "result": {
    "envelope": {
      "version": 1,
      "items": [
        {
          "kind": "product",
          "id": "text",
          "defaultVariantId": "text",
          "allowedVariantIds": [
            "text"
          ],
          "sellingPlanId": "text",
          "intent": "add",
          "discount": {
            "type": "percentage",
            "value": 1
          },
          "sourceBranch": "text",
          "children": [
            {
              "kind": "product",
              "id": "text",
              "quantity": 1
            }
          ]
        }
      ],
      "branchFired": {
        "base": "text",
        "instance": "text"
      },
      "cartFingerprint": "text",
      "warnings": [
        "text"
      ],
      "metadata": {
        "ANY_ADDITIONAL_PROPERTY": "anything"
      }
    },
    "telemetry": {
      "outcome": "result",
      "errorClass": "text",
      "datasetRevisions": [
        {
          "key": "text",
          "revision": 1
        }
      ],
      "removedByExclusion": [
        {
          "itemId": "text",
          "reason": "product_id"
        }
      ],
      "attempts": [
        {
          "base": "text",
          "instance": "text",
          "contributed": 1,
          "outcome": "contributed"
        }
      ],
      "evaluationSource": "serving",
      "executionTier": "template",
      "deadlineMs": 1,
      "fallback": "not-applicable",
      "classifierBreakerTripped": true
    }
  }
}

Get exclusions

get
GET /v25-10-beta/agentic-logic/exclusions

Returns the organization's exclusion set as { exclusions }. Use the intelligems-access-token header.

  • productIds (string array) — Shopify product GIDs.

  • tags (string array) — Exact product tags.

  • collections (string array) — Shopify collection GIDs; their members are excluded.

  • vendors (string array) — Exact vendor names.

  • lastUpdateTs (number or null) — Last edit time in Unix epoch milliseconds; null when the organization has never saved exclusions, in which case every list is empty.

Use the intelligems-access-token header. The token selects the organization; do not send orgId. The organization must have Agentic Logic enabled.

Rate Limit: 50 requests per 30s window, refilling 25 tokens every 30s.

Authorizations
intelligems-access-tokenstringRequired

Intelligems external API access token.

Responses
200

OK

application/json
get/v25-10-beta/agentic-logic/exclusions
Request
curl --request GET \
  "https://api.intelligems.io/v25-10-beta/agentic-logic/exclusions" \
  --header "intelligems-access-token: YOUR_API_KEY"
{
  "exclusions": {
    "productIds": [
      "text"
    ],
    "tags": [
      "text"
    ],
    "collections": [
      "text"
    ],
    "vendors": [
      "text"
    ],
    "lastUpdateTs": 1
  }
}

Update exclusions

patch
PATCH /v25-10-beta/agentic-logic/exclusions

Adds and removes selected organization-wide exclusions. The operation preserves all values that the request does not name and returns the complete updated exclusion set.

  • add (object, optional) — Exclusion values to add.

  • remove (object, optional) — Exclusion values to remove.

  • add.productIds / remove.productIds (string array, optional) — Shopify product GIDs.

  • add.tags / remove.tags (string array, optional) — Exact product tags.

  • add.collections / remove.collections (string array, optional) — Shopify collection GIDs.

  • add.vendors / remove.vendors (string array, optional) — Exact vendor names.

The request must add or remove at least one value. A value cannot occur in both operations for the same field.

  • Adding an existing value and removing a missing value are successful no-ops.

  • The update is atomic and takes effect on the next evaluation for every rule.

  • No rule publish is required.

Use the intelligems-access-token header. The token selects the organization; do not send orgId. The organization must have Agentic Logic enabled.

Rate Limit: 50 requests per 30s window, refilling 25 tokens every 30s.

Authorizations
intelligems-access-tokenstringRequired

Intelligems external API access token.

Body

Add or remove selected org exclusions without replacing unrelated values. Effective immediately on the next evaluation; no republish.

Responses
200

OK

application/json
patch/v25-10-beta/agentic-logic/exclusions
Request
curl --request PATCH \
  "https://api.intelligems.io/v25-10-beta/agentic-logic/exclusions" \
  --header "intelligems-access-token: YOUR_API_KEY" \
  --header "Content-Type: application/json" \
  --data @request.json
{
  "exclusions": {
    "productIds": [
      "text"
    ],
    "tags": [
      "text"
    ],
    "collections": [
      "text"
    ],
    "vendors": [
      "text"
    ],
    "lastUpdateTs": 1
  }
}

List placements

get
GET /v25-10-beta/agentic-logic/placements

Lists the organization's placements.

Use the intelligems-access-token header. The token selects the organization; do not send orgId. The organization must have Agentic Logic enabled.

Rate Limit: 50 requests per 30s window, refilling 25 tokens every 30s.

Authorizations
intelligems-access-tokenstringRequired

Intelligems external API access token.

Responses
200

OK

application/json
get/v25-10-beta/agentic-logic/placements
Request
curl --request GET \
  "https://api.intelligems.io/v25-10-beta/agentic-logic/placements" \
  --header "intelligems-access-token: YOUR_API_KEY"
{
  "placements": [
    {
      "id": "text",
      "organizationId": "text",
      "name": "text",
      "surface": "onsite",
      "createdAtTs": 1,
      "lastUpdateTs": 1,
      "lastSeenAtTs": 1
    }
  ]
}

Create a placement

post
POST /v25-10-beta/agentic-logic/placements

Creates a placement — a named slot on a surface that rules serve into.

  • name (string, required) — Merchant-facing placement name.

  • surface (string, required) — onsite, checkout, or post-purchase. Fixed at creation.

The returned placement.id is the placementId used by evaluation requests.

Use the intelligems-access-token header. The token selects the organization; do not send orgId. The organization must have Agentic Logic enabled.

Rate Limit: 50 requests per 30s window, refilling 25 tokens every 30s.

Authorizations
intelligems-access-tokenstringRequired

Intelligems external API access token.

Body

Create a placement. The response's server-issued id is the wire placementId.

namestring · min: 1Required

Merchant-facing placement name.

surfacestring · enumRequired

Surface the placement renders on. Fixed at creation.

Possible values:
Responses
200

OK

application/json
post/v25-10-beta/agentic-logic/placements
Request
curl --request POST \
  "https://api.intelligems.io/v25-10-beta/agentic-logic/placements" \
  --header "intelligems-access-token: YOUR_API_KEY" \
  --header "Content-Type: application/json" \
  --data @request.json
{
  "placement": {
    "id": "text",
    "organizationId": "text",
    "name": "text",
    "surface": "onsite",
    "createdAtTs": 1,
    "lastUpdateTs": 1,
    "lastSeenAtTs": 1
  }
}

Delete a placement

delete
DELETE /v25-10-beta/agentic-logic/placements/{placementId}

Deletes a placement. A placement with any assignment answers 409; delete or move its assignments first.

Use the intelligems-access-token header. The token selects the organization; do not send orgId. The organization must have Agentic Logic enabled.

Rate Limit: 50 requests per 30s window, refilling 25 tokens every 30s.

Authorizations
intelligems-access-tokenstringRequired

Intelligems external API access token.

Path parameters
placementIdstring · uuidRequiredPattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Responses
200

OK

application/json
Responseobject
delete/v25-10-beta/agentic-logic/placements/{placementId}
Request
curl --request DELETE \
  "https://api.intelligems.io/v25-10-beta/agentic-logic/placements/<placementId>" \
  --header "intelligems-access-token: YOUR_API_KEY"
{}

Rename a placement

patch
PATCH /v25-10-beta/agentic-logic/placements/{placementId}

Renames a placement. The id and surface never change.

Use the intelligems-access-token header. The token selects the organization; do not send orgId. The organization must have Agentic Logic enabled.

Rate Limit: 50 requests per 30s window, refilling 25 tokens every 30s.

Authorizations
intelligems-access-tokenstringRequired

Intelligems external API access token.

Path parameters
placementIdstring · uuidRequiredPattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Body

Edit a placement's name. The id and surface never change, and the empty-result policy belongs to the rule.

namestring · min: 1Optional

New merchant-facing name.

Responses
200

OK

application/json
patch/v25-10-beta/agentic-logic/placements/{placementId}
Request
curl --request PATCH \
  "https://api.intelligems.io/v25-10-beta/agentic-logic/placements/<placementId>" \
  --header "intelligems-access-token: YOUR_API_KEY" \
  --header "Content-Type: application/json" \
  --data @request.json
{
  "placement": {
    "id": "text",
    "organizationId": "text",
    "name": "text",
    "surface": "onsite",
    "createdAtTs": 1,
    "lastUpdateTs": 1,
    "lastSeenAtTs": 1
  }
}

List rules

get
GET /v25-10-beta/agentic-logic/rules

Lists every Agentic Logic rule in the organization.

  • Rules in every lifecycle state (draft, active, paused) are returned; filter client-side on state.

  • managedBy distinguishes builder-template rules (builder) from code rules (code).

Use the intelligems-access-token header. The token selects the organization; do not send orgId. The organization must have Agentic Logic enabled.

Rate Limit: 50 requests per 30s window, refilling 25 tokens every 30s.

Authorizations
intelligems-access-tokenstringRequired

Intelligems external API access token.

Responses
200

OK

application/json
get/v25-10-beta/agentic-logic/rules
Request
curl --request GET \
  "https://api.intelligems.io/v25-10-beta/agentic-logic/rules" \
  --header "intelligems-access-token: YOUR_API_KEY"
{
  "rules": [
    {
      "id": "text",
      "organizationId": "text",
      "name": "text",
      "description": "text",
      "managedBy": "builder",
      "state": "draft",
      "templateId": "text",
      "templateParams": {
        "ANY_ADDITIONAL_PROPERTY": "anything"
      },
      "templateVersion": 1,
      "targetSurfaces": [
        "onsite"
      ],
      "settings": {
        "maxItems": 3,
        "excludeOutOfStock": true,
        "excludeItemsInCart": true,
        "excludePdpProduct": true,
        "onEmpty": "hide"
      },
      "authoringSessionId": "text",
      "systemKey": "shopify-recommendations",
      "createdAtTs": 1,
      "lastUpdateTs": 1
    }
  ]
}

Create a rule

post
POST /v25-10-beta/agentic-logic/rules

Creates a rule in the draft state. The response is { rule }.

  • name (string, required) — Merchant-facing rule name.

  • description (string, required, 1–1024 characters) — Plain-language summary of what the rule recommends, in what order, and for which shoppers.

  • managedBy (string, required) — builder for a template-configured rule, or code for a rule whose source you author through the draft endpoint. Fixed after creation.

  • settings (object, optional) — Recommendation settings: maxItems (1–10), excludeOutOfStock, excludeItemsInCart, and onEmpty (hide or smart-recs), all required when the object is sent. Omit it to take the defaults: 3 items, both exclusions on, hide.

A builder rule also takes:

  • templateId (string, required) — Template to configure.

  • templateParams (object, optional) — Validated against the template's params schema.

  • templateVersion (number, optional) — Template version the params were written against.

Builder rules don't take targetSurfaces; their template sets the surfaces.

A code rule also takes:

  • targetSurfaces (string array, required) — The surfaces (onsite, checkout, post-purchase) whose placements the rule may be assigned to. Non-empty, with no repeats, and fixed after creation.

  • authoringSessionId (string, optional) — The AI chat session authoring the rule.

A code-rule body is strict: unknown fields are rejected.

Creating a builder rule starts its first publish. A code rule needs a saved draft before it can publish (see Save a code rule's draft). A rule serves nothing until it has an active version and is assigned to a placement.

Use the intelligems-access-token header. The token selects the organization; do not send orgId. The organization must have Agentic Logic enabled.

Rate Limit: 50 requests per 30s window, refilling 25 tokens every 30s.

Authorizations
intelligems-access-tokenstringRequired

Intelligems external API access token.

Body

Create a rule container (state starts at 'draft').

or
Responses
200

OK

application/json
post/v25-10-beta/agentic-logic/rules
Request
curl --request POST \
  "https://api.intelligems.io/v25-10-beta/agentic-logic/rules" \
  --header "intelligems-access-token: YOUR_API_KEY" \
  --header "Content-Type: application/json" \
  --data @request.json
{
  "rule": {
    "id": "text",
    "organizationId": "text",
    "name": "text",
    "description": "text",
    "managedBy": "builder",
    "state": "draft",
    "templateId": "text",
    "templateParams": {
      "ANY_ADDITIONAL_PROPERTY": "anything"
    },
    "templateVersion": 1,
    "targetSurfaces": [
      "onsite"
    ],
    "settings": {
      "maxItems": 3,
      "excludeOutOfStock": true,
      "excludeItemsInCart": true,
      "excludePdpProduct": true,
      "onEmpty": "hide"
    },
    "authoringSessionId": "text",
    "systemKey": "shopify-recommendations",
    "createdAtTs": 1,
    "lastUpdateTs": 1
  }
}

Get a rule

get
GET /v25-10-beta/agentic-logic/rules/{ruleId}

Gets one rule by id. The response is { rule, latestPublishJob, activeRepairRun }:

  • latestPublishJob — The rule's most recent publish job (the same object Poll a publish job returns under job), or null when it has none.

  • activeRepairRun — The rule's AI repair run, live or most recently finished, or null when it never had one. It carries the run's status, attempt count, the job it is following, and why it stopped.

Use the intelligems-access-token header. The token selects the organization; do not send orgId. The organization must have Agentic Logic enabled.

Rate Limit: 50 requests per 30s window, refilling 25 tokens every 30s.

Authorizations
intelligems-access-tokenstringRequired

Intelligems external API access token.

Path parameters
ruleIdstring · uuidRequiredPattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Responses
200

OK

application/json
get/v25-10-beta/agentic-logic/rules/{ruleId}
Request
curl --request GET \
  "https://api.intelligems.io/v25-10-beta/agentic-logic/rules/<ruleId>" \
  --header "intelligems-access-token: YOUR_API_KEY"
{
  "rule": {
    "id": "text",
    "organizationId": "text",
    "name": "text",
    "description": "text",
    "managedBy": "builder",
    "state": "draft",
    "templateId": "text",
    "templateParams": {
      "ANY_ADDITIONAL_PROPERTY": "anything"
    },
    "templateVersion": 1,
    "targetSurfaces": [
      "onsite"
    ],
    "settings": {
      "maxItems": 3,
      "excludeOutOfStock": true,
      "excludeItemsInCart": true,
      "excludePdpProduct": true,
      "onEmpty": "hide"
    },
    "authoringSessionId": "text",
    "systemKey": "shopify-recommendations",
    "createdAtTs": 1,
    "lastUpdateTs": 1
  },
  "latestPublishJob": {
    "id": "text",
    "ruleId": "text",
    "status": "queued",
    "mode": "publish",
    "startedAtTs": 1,
    "finishedAtTs": 1,
    "resultingVersionId": "text",
    "gates": [
      {
        "gateKey": "static_contract",
        "status": "pending",
        "result": "text",
        "detailsJson": {
          "ANY_ADDITIONAL_PROPERTY": "anything"
        },
        "startedAtTs": 1,
        "finishedAtTs": 1
      }
    ]
  },
  "activeRepairRun": {
    "id": "text",
    "publishOnSuccess": true,
    "status": "queued",
    "purpose": "initial_publish",
    "attempt": 1,
    "maxAttempts": 1,
    "currentPublishJobId": "text",
    "baselineDraftS3Key": "text",
    "giveUp": {
      "cause": "manual_publish",
      "blockingGate": "text",
      "diagnosis": "text",
      "counterProposal": {
        "summary": "text",
        "tradeoff": "text",
        "actionKind": "adjust_request",
        "templateId": "text"
      },
      "attempts": [
        {
          "attempt": 1,
          "failedGate": "text",
          "whatWasTried": "text",
          "semanticRemedyApplied": false
        }
      ]
    },
    "createdAtTs": 1,
    "finishedAtTs": 1,
    "attempts": [
      {
        "attempt": 1,
        "publishJobId": "text",
        "status": "queued",
        "finishedAtTs": 1,
        "failedGates": [
          {
            "gateKey": "static_contract",
            "status": "pending",
            "result": "text",
            "detailsJson": {
              "ANY_ADDITIONAL_PROPERTY": "anything"
            },
            "startedAtTs": 1,
            "finishedAtTs": 1
          }
        ]
      }
    ],
    "pendingApproval": {
      "changeSummary": "text",
      "construct": "text",
      "remedy": "text"
    }
  }
}

Delete a rule

delete
DELETE /v25-10-beta/agentic-logic/rules/{ruleId}

Deletes a rule.

  • Deletion is how a rule is retired, and is legal from every lifecycle state (draft, active, paused). There is no archive step and no archived state.

  • A rule referenced by a placement assignment or an experiment arm cannot be deleted; the error names each reference so you can unbind it.

  • Deletion is permanent: the rule's compute is released and its stored artifacts are swept.

Use the intelligems-access-token header. The token selects the organization; do not send orgId. The organization must have Agentic Logic enabled.

Rate Limit: 50 requests per 30s window, refilling 25 tokens every 30s.

Authorizations
intelligems-access-tokenstringRequired

Intelligems external API access token.

Path parameters
ruleIdstring · uuidRequiredPattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Responses
200

OK

application/json
Responseobject
delete/v25-10-beta/agentic-logic/rules/{ruleId}
Request
curl --request DELETE \
  "https://api.intelligems.io/v25-10-beta/agentic-logic/rules/<ruleId>" \
  --header "intelligems-access-token: YOUR_API_KEY"
{}

Update a rule

patch
PATCH /v25-10-beta/agentic-logic/rules/{ruleId}

Updates a rule's name, description, settings, or builder-template configuration. The response is { rule }. This endpoint never changes the rule's lifecycle state, and targetSurfaces cannot change.

  • name (string, optional) — New merchant-facing name.

  • description (string, optional, 1–1024 characters) — New plain-language summary.

  • settings (object, optional) — New recommendation settings, the same shape as on create. Replaces the stored object whole: a partial object is not merged.

  • templateParams (object, optional) — New template parameters (builder rules only).

  • templateVersion (number, optional) — New template version (builder rules only; must be sent with templateParams).

  • authoringSessionId (string, optional) — The AI chat session that authored the rule.

Settings and template changes take effect at the next publish; the currently active version keeps serving until then.

Use the intelligems-access-token header. The token selects the organization; do not send orgId. The organization must have Agentic Logic enabled.

Rate Limit: 50 requests per 30s window, refilling 25 tokens every 30s.

Authorizations
intelligems-access-tokenstringRequired

Intelligems external API access token.

Path parameters
ruleIdstring · uuidRequiredPattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Body

Update a rule's mutable fields. Lifecycle state moves through the lifecycle verbs, never through this endpoint.

namestring · min: 1Optional

New merchant-facing name.

descriptionstring · min: 1 · max: 1024Optional

New plain-language rule summary.

templateVersioninteger · max: 9007199254740991Optional

Template artifact version the new params were authored against.

authoringSessionIdstring · min: 1Optional

Id of the AI chat session that authored this rule, recorded by the workspace client once the session id is known (the create call is made by a tool that does not carry it). Re-sending the stored id is a no-op; a different id repoints the rule at that newer conversation, which is what a revision session does when it finishes.

Responses
200

OK

application/json
patch/v25-10-beta/agentic-logic/rules/{ruleId}
Request
curl --request PATCH \
  "https://api.intelligems.io/v25-10-beta/agentic-logic/rules/<ruleId>" \
  --header "intelligems-access-token: YOUR_API_KEY" \
  --header "Content-Type: application/json" \
  --data @request.json
{
  "rule": {
    "id": "text",
    "organizationId": "text",
    "name": "text",
    "description": "text",
    "managedBy": "builder",
    "state": "draft",
    "templateId": "text",
    "templateParams": {
      "ANY_ADDITIONAL_PROPERTY": "anything"
    },
    "templateVersion": 1,
    "targetSurfaces": [
      "onsite"
    ],
    "settings": {
      "maxItems": 3,
      "excludeOutOfStock": true,
      "excludeItemsInCart": true,
      "excludePdpProduct": true,
      "onEmpty": "hide"
    },
    "authoringSessionId": "text",
    "systemKey": "shopify-recommendations",
    "createdAtTs": 1,
    "lastUpdateTs": 1
  }
}

Rule actions

post
POST /v25-10-beta/agentic-logic/rules/{ruleId}/actions/{action}

Performs a synchronous lifecycle action on a rule.

  • pause — Stop serving the rule. Idempotent: pausing a paused rule returns its current state.

  • resume — Serve the rule again. Requires a published version; a never-published rule answers 409.

  • rollback — Instantly move the active-version pointer to an older published version. Requires version in the body; the rule must be active.

Body: version (number, optional) — Publish number to activate. Required for rollback, rejected for every other action.

  • Publishing and gate dry runs are not actions here — they are asynchronous and have their own endpoints with a poll resource.

  • Retiring a rule is not an action here either — it is DELETE /v25-10-beta/agentic-logic/rules/{ruleId}. archive and restore are rejected.

  • The response returns the rule; rollback additionally returns activeVersionId.

Use the intelligems-access-token header. The token selects the organization; do not send orgId. The organization must have Agentic Logic enabled.

Rate Limit: 50 requests per 30s window, refilling 25 tokens every 30s.

Authorizations
intelligems-access-tokenstringRequired

Intelligems external API access token.

Path parameters
ruleIdstring · uuidRequiredPattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
actionstring · enumRequiredPossible values:
Body

Lifecycle action body for the external actions route. rollback requires version; every other action rejects it.

versioninteger · min: 1 · max: 9007199254740991Optional

Publish number of the version to activate. Required for rollback, rejected for the other actions.

Responses
200

OK

application/json
post/v25-10-beta/agentic-logic/rules/{ruleId}/actions/{action}
Request
curl --request POST \
  "https://api.intelligems.io/v25-10-beta/agentic-logic/rules/<ruleId>/actions/<action>" \
  --header "intelligems-access-token: YOUR_API_KEY" \
  --header "Content-Type: application/json" \
  --data @request.json
{
  "rule": {
    "id": "text",
    "organizationId": "text",
    "name": "text",
    "description": "text",
    "managedBy": "builder",
    "state": "draft",
    "templateId": "text",
    "templateParams": {
      "ANY_ADDITIONAL_PROPERTY": "anything"
    },
    "templateVersion": 1,
    "targetSurfaces": [
      "onsite"
    ],
    "settings": {
      "maxItems": 3,
      "excludeOutOfStock": true,
      "excludeItemsInCart": true,
      "excludePdpProduct": true,
      "onEmpty": "hide"
    },
    "authoringSessionId": "text",
    "systemKey": "shopify-recommendations",
    "createdAtTs": 1,
    "lastUpdateTs": 1
  },
  "activeVersionId": "text"
}

Cancel a check run

post
POST /v25-10-beta/agentic-logic/rules/{ruleId}/cancel-checks

Stops the check run a job belongs to. It works on jobs of either mode: a dry_run, including one started by run-gates, or a publish.

  • publishJobId (uuid, required) — The job to cancel. It must belong to the rule; an unknown job answers 404.

The cancel is live when the named job is still queued or running, or when the rule's AI repair run is working that job. A live cancel stops all of these in one transaction:

  • the named job, if it is still in flight;

  • the rule's live repair run, which ends abandoned and starts no further attempts;

  • every other queued or running job of the rule, publish or dry run.

Cancelled jobs end cancelled. Gates that were mid-run go back to pending; finished gates keep their results. A publish job cancelled before it promotes creates no version and leaves the active version unchanged.

The response is { job, cancelled }. job is the named job after the request, in the poll shape. cancelled is true when this request stopped anything. A failed job whose repair run this request stopped stays failed, with cancelled: true.

cancelled is false when the named job had already finished (succeeded, failed, or cancelled) and no repair run is working it. Nothing changes then, and other jobs of the rule keep running. Repeating a cancel is safe. A succeeded publish is not undone; use rollback for that.

Use the intelligems-access-token header. The token selects the organization; do not send orgId. The organization must have Agentic Logic enabled.

Rate Limit: 50 requests per 30s window, refilling 25 tokens every 30s.

Authorizations
intelligems-access-tokenstringRequired

Intelligems external API access token.

Path parameters
ruleIdstring · uuidRequiredPattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Body
publishJobIdstring · uuidRequiredPattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Responses
200

OK

application/json
post/v25-10-beta/agentic-logic/rules/{ruleId}/cancel-checks
Request
curl --request POST \
  "https://api.intelligems.io/v25-10-beta/agentic-logic/rules/<ruleId>/cancel-checks" \
  --header "intelligems-access-token: YOUR_API_KEY" \
  --header "Content-Type: application/json" \
  --data @request.json
{
  "job": {
    "id": "text",
    "ruleId": "text",
    "status": "queued",
    "mode": "publish",
    "startedAtTs": 1,
    "finishedAtTs": 1,
    "resultingVersionId": "text",
    "gates": [
      {
        "gateKey": "static_contract",
        "status": "pending",
        "result": "text",
        "detailsJson": {
          "ANY_ADDITIONAL_PROPERTY": "anything"
        },
        "startedAtTs": 1,
        "finishedAtTs": 1
      }
    ]
  },
  "cancelled": true
}

Get a code rule's draft

get
GET /v25-10-beta/agentic-logic/rules/{ruleId}/draft

Gets the saved draft (source, user tests, dependencies) of a code rule. Secret values never appear in a draft: rule source references organization secrets by sentinel name only.

Use the intelligems-access-token header. The token selects the organization; do not send orgId. The organization must have Agentic Logic enabled.

Rate Limit: 50 requests per 30s window, refilling 25 tokens every 30s.

Authorizations
intelligems-access-tokenstringRequired

Intelligems external API access token.

Path parameters
ruleIdstring · uuidRequiredPattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Responses
200

OK

application/json
get/v25-10-beta/agentic-logic/rules/{ruleId}/draft
Request
curl --request GET \
  "https://api.intelligems.io/v25-10-beta/agentic-logic/rules/<ruleId>/draft" \
  --header "intelligems-access-token: YOUR_API_KEY"
{
  "draft": {
    "ruleId": "text",
    "source": "text",
    "userTestSuite": "text",
    "generatedTestSuite": "text",
    "dependencies": [
      {
        "name": "text",
        "version": "text"
      }
    ],
    "updatedByUserId": "text",
    "updatedByUser": {
      "name": "text"
    },
    "lastUpdateTs": 1,
    "origin": "chat",
    "graph": {
      "version": 1,
      "nodes": [
        {
          "id": "text",
          "kind": "input",
          "label": "text",
          "summary": "text",
          "branchId": "text",
          "meta": {
            "itemCount": 1,
            "sampleItems": [
              "text"
            ],
            "condition": "text",
            "conditionSubject": "cart",
            "sortKey": "text",
            "limit": 1,
            "ANY_ADDITIONAL_PROPERTY": "anything"
          }
        }
      ],
      "edges": [
        {
          "from": "text",
          "to": "text",
          "kind": "flow"
        }
      ]
    },
    "contentFingerprint": "text"
  }
}

Save a code rule's draft

put
PUT /v25-10-beta/agentic-logic/rules/{ruleId}/draft

Saves the draft of a code rule. The response is { draft }. A builder rule answers 400.

  • source (string, required) — The rule source.

  • dependencies (array, optional) — Must be empty: rules run with no npm packages.

  • userTestSuite / generatedTestSuite (string, optional) — Omit to keep the stored suite; send "" to clear it.

  • validationScenarios (array, optional) — Scenarios the publish checks run the rule against. Omit to keep the stored ones; send [] to discard them.

  • graph (object, optional) — The rule graph for this source, checked against it at save time. When omitted, the stored graph is kept only if the source is unchanged.

  • origin (chat or manual, optional) — Where the source came from. Omit to keep the stored value.

  • autoAssist (boolean, optional) — Whether the save starts AI assistance. Defaults to true. Send false to only store the draft (see below). Applies to this call only; it is not stored on the rule.

Every save replaces the previous draft. Publish snapshots the draft, so an in-flight publish is not affected by a later save. Unless autoAssist is false, a save also:

  • Regenerates the rule graph with AI when the saved draft has no graph.

  • Regenerates the AI-generated validation scenarios when they no longer cover the source's attempt() branches. Scenarios you authored are kept.

The first save of a draft rule that has never had a publish job, and that does not send autoAssist: false, also starts a dry run of the publish checks. If the checks fail, an AI repair loop rewrites the draft and runs them again, within its attempt, time, and cost limits. Once the checks pass, the rule is published without any further call. If a rewrite changed what the rule does, the loop stops instead and leaves the rewritten draft for a person to publish.

Saving a draft does not stop a running repair loop. If you save while the loop is rewriting, the loop's rewrite is dropped, that attempt counts against its limit, and the loop decides its next step from your draft.

With autoAssist: false, the save starts neither the regeneration above nor the dry run, and it does not stop a repair loop that is already running. A later save without the flag still starts the dry run while the rule has never had a publish job. A later publish still works: with no graph the graph check passes with a note, with no scenarios the default scenario is used, and the AI test suite is generated at publish time.

A save that omits validationScenarios keeps the stored ones unchanged, so scenarios from an earlier save, including AI-generated ones, carry forward and may no longer match the new source's branches. While they do not, the scenarios listing reports pending until a save without autoAssist: false regenerates them, or a save sends a full generated set: sent scenarios replace the stored ones rather than adding to them.

Use the intelligems-access-token header. The token selects the organization; do not send orgId. The organization must have Agentic Logic enabled.

Rate Limit: 50 requests per 30s window, refilling 25 tokens every 30s.

Authorizations
intelligems-access-tokenstringRequired

Intelligems external API access token.

Path parameters
ruleIdstring · uuidRequiredPattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Body

Overwrite the rule's single draft. Publishing snapshots the draft at job creation, so later saves never change an in-flight publish.

sourcestringRequired

Draft rule source code.

userTestSuitestringOptional

User-authored test suite to persist with the draft. Omit to leave the existing suite untouched; send an empty string to clear it.

generatedTestSuitestringOptional

Edits to the AI-generated test suite. Omit to leave the stored suite untouched; send an empty string to clear it and let the next publish generate a fresh one. An explicit suite is stored as hand-authored, so the next publish runs it to decide whether it still covers the rule rather than assuming either way.

originstring · enumOptional

Provenance of the submitted source: 'chat' when the editor buffer was applied from the workspace AI chat and untouched since, 'manual' when a person authored or last edited it. Omit to leave the stored provenance untouched.

Possible values:
autoAssistbooleanOptional

Whether the save starts AI assistance. Defaults to true. False stores the draft without starting AI graph or scenario regeneration, the initial dry run, or a repair loop; a repair loop already running is not stopped. Applies to this call only.

Responses
200

OK

application/json
put/v25-10-beta/agentic-logic/rules/{ruleId}/draft
Request
curl --request PUT \
  "https://api.intelligems.io/v25-10-beta/agentic-logic/rules/<ruleId>/draft" \
  --header "intelligems-access-token: YOUR_API_KEY" \
  --header "Content-Type: application/json" \
  --data @request.json
{
  "draft": {
    "ruleId": "text",
    "source": "text",
    "userTestSuite": "text",
    "generatedTestSuite": "text",
    "dependencies": [
      {
        "name": "text",
        "version": "text"
      }
    ],
    "updatedByUserId": "text",
    "updatedByUser": {
      "name": "text"
    },
    "lastUpdateTs": 1,
    "origin": "chat",
    "graph": {
      "version": 1,
      "nodes": [
        {
          "id": "text",
          "kind": "input",
          "label": "text",
          "summary": "text",
          "branchId": "text",
          "meta": {
            "itemCount": 1,
            "sampleItems": [
              "text"
            ],
            "condition": "text",
            "conditionSubject": "cart",
            "sortKey": "text",
            "limit": 1,
            "ANY_ADDITIONAL_PROPERTY": "anything"
          }
        }
      ],
      "edges": [
        {
          "from": "text",
          "to": "text",
          "kind": "flow"
        }
      ]
    },
    "contentFingerprint": "text"
  }
}

Validate a code rule's draft

post
POST /v25-10-beta/agentic-logic/rules/{ruleId}/draft/validate

Runs the publish pipeline's static_contract check (the evaluate export contract, ESM compatibility, and the sandbox source guard) on the saved draft. Nothing is published or persisted.

  • No body. The response is { "valid": true } or { "valid": false, "message": "...", "details": { ... } | null }, where details carries the gate's structured fields (for example reason: "missing_evaluate_export", or reason: "source_guard_refusal" with construct and remedy).

  • A failed check is a 200 with valid: false, not an error.

  • A builder rule answers 409: it has no code draft, so validate its template params instead. A code rule with no saved draft source answers 404.

  • Only the first publish gate runs; a valid draft can still fail a later gate (tests, budgets, deployment) when it is published.

Use the intelligems-access-token header. The token selects the organization; do not send orgId. The organization must have Agentic Logic enabled.

Rate Limit: 50 requests per 30s window, refilling 25 tokens every 30s.

Authorizations
intelligems-access-tokenstringRequired

Intelligems external API access token.

Path parameters
ruleIdstring · uuidRequiredPattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Responses
200

OK

application/json
Responseone of
or
post/v25-10-beta/agentic-logic/rules/{ruleId}/draft/validate
Request
curl --request POST \
  "https://api.intelligems.io/v25-10-beta/agentic-logic/rules/<ruleId>/draft/validate" \
  --header "intelligems-access-token: YOUR_API_KEY"
{
  "valid": true
}

Evaluate a scenario

post
POST /v25-10-beta/agentic-logic/rules/{ruleId}/evaluate-scenario

Runs one scenario against the rule's saved draft (code rules) or current template configuration (builder rules), under the rule's current settings. nothing is persisted.

  • scenario (object, required) — The full scenario. request.placementId defaults to the rule's own id.

  • A code rule with no saved draft source answers 404.

The response is the admin's scenario preview (result, exclusions, coverage, hydratedItems, onEmpty, evaluated), plus logs for code rules:

  • logs — What the rule's logger calls wrote during this run, in call order, as { level, message, details?, invocationId?, timestamp }. Logs are returned when the rule completes, when it returns a malformed envelope (errorClass: "invalid_envelope"), when it throws, and when it exceeds the budget. They are [] when the rule logged nothing. A failed run whose output exceeds 256KB keeps only its earliest and latest entries, and the response then carries logsTruncated: true. A failure on the platform side, such as a failed SDK read, is rethrown by the sandbox runner without its output, so it returns an error result with no logs key. That includes a throw after the rule caught a failed SDK read; a budget overrun after one still returns its logs. Plain console.log output is not included. Builder rules have no logs key.

  • timestamp is ISO-8601 UTC host wall-clock time at the moment logger was called, with millisecond precision. Subtract two entries' timestamps to get the elapsed time between those calls, for example around a branch or a read.

A code rule's preview runs under a fixed 5000ms budget (AGENTIC_LOGIC_RUNTIME_BUDGET_MAX_MS), whatever budget its placements assign. The budget is wall-clock time for the whole evaluate call, SDK reads included. A run that exceeds it returns an error result with errorClass: "timeout" whose warning contains Rule exceeded runtime ceiling of 5000ms. Its logs hold the entries written before the timeout.

Use the intelligems-access-token header. The token selects the organization; do not send orgId. The organization must have Agentic Logic enabled.

Rate Limit: 50 requests per 30s window, refilling 25 tokens every 30s.

Authorizations
intelligems-access-tokenstringRequired

Intelligems external API access token.

Path parameters
ruleIdstring · uuidRequiredPattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Body
Responses
200

OK

application/json
post/v25-10-beta/agentic-logic/rules/{ruleId}/evaluate-scenario
Request
curl --request POST \
  "https://api.intelligems.io/v25-10-beta/agentic-logic/rules/<ruleId>/evaluate-scenario" \
  --header "intelligems-access-token: YOUR_API_KEY" \
  --header "Content-Type: application/json" \
  --data @request.json
{
  "result": {
    "envelope": {
      "version": 1,
      "items": [
        {
          "kind": "product",
          "id": "text",
          "defaultVariantId": "text",
          "allowedVariantIds": [
            "text"
          ],
          "sellingPlanId": "text",
          "intent": "add",
          "discount": {
            "type": "percentage",
            "value": 1
          },
          "sourceBranch": "text",
          "children": [
            {
              "kind": "product",
              "id": "text",
              "quantity": 1
            }
          ]
        }
      ],
      "branchFired": {
        "base": "text",
        "instance": "text"
      },
      "cartFingerprint": "text",
      "warnings": [
        "text"
      ],
      "metadata": {
        "ANY_ADDITIONAL_PROPERTY": "anything"
      }
    },
    "telemetry": {
      "outcome": "result",
      "errorClass": "text",
      "datasetRevisions": [
        {
          "key": "text",
          "revision": 1
        }
      ],
      "removedByExclusion": [
        {
          "itemId": "text",
          "reason": "product_id"
        }
      ],
      "attempts": [
        {
          "base": "text",
          "instance": "text",
          "contributed": 1,
          "outcome": "contributed"
        }
      ],
      "evaluationSource": "serving",
      "executionTier": "template",
      "deadlineMs": 1,
      "fallback": "not-applicable",
      "classifierBreakerTripped": true
    }
  },
  "exclusions": {
    "evaluated": true,
    "removals": [
      {
        "itemId": "text",
        "reason": "product_id",
        "matchedValue": "text"
      }
    ]
  },
  "coverage": {
    "firedBranchId": "text",
    "branchStates": {
      "ANY_ADDITIONAL_PROPERTY": "fired"
    },
    "traversedNodeIds": [
      "text"
    ],
    "terminalNodeId": "text"
  },
  "hydratedItems": [
    {
      "id": "text",
      "variantId": "text",
      "title": "text",
      "variantTitle": "text",
      "price": "text"
    }
  ],
  "onEmpty": "hide",
  "evaluated": {
    "source": "draft",
    "version": 1
  },
  "logs": [
    {
      "level": "log",
      "message": "text",
      "details": null,
      "invocationId": "123e4567-e89b-12d3-a456-426614174000",
      "timestamp": "2026-01-01T00:00:00.000Z"
    }
  ],
  "logsTruncated": true
}

Publish a rule

post

Success status: 202 Accepted.

POST /v25-10-beta/agentic-logic/rules/{ruleId}/publish

Starts an asynchronous publish job for the rule's current draft (code rules) or template configuration (builder rules).

  • notes (string, optional) — Notes stamped on the resulting version.

  • title (string, optional, up to 255 characters) — Display title stamped on the resulting version. When omitted, a draft that came from the AI chat gets "Built from chat" and any other draft gets no title.

  • idempotencyKey (string, optional) — Client-supplied key. Repeating a publish for the same rule and key returns the existing job handle instead of starting another job.

  • autoAssist (boolean, optional) — Whether a failed job starts AI repair. Defaults to true. Send false to leave a failed job failed (see below). It is frozen into this job only; it is not stored on the rule.

The endpoint answers 202 Accepted with { "publishJobId": "..." }. Publishing runs a gate pipeline (static checks, tests, budget and safety gates, deployment) that takes seconds to minutes; poll the publish job until status is succeeded, failed, or cancelled. A successful publish makes the new version active immediately. A first publish moves a draft rule to active; a publish never resumes a paused rule.

  • When a code rule's draft has no validation scenarios, the checks run one default scenario: an onsite request in USD from the US, with the rule's id as the placement.

  • A failed publish of a code rule opens an AI repair run, unless one is already running. The repair loop rewrites the draft and re-runs the checks; when they pass, it publishes the rewritten source, unless the rewrite changed what the rule does. Follow it through activeRepairRun on Get a rule; the failed job itself stays failed.

With autoAssist: false, a failed job opens no repair run, so the platform never rewrites the rule's source or republishes it on its own. It does not stop a repair run that is already running; cancel does. A successful publish is unaffected.

A repeated idempotencyKey returns the job it first started, with the autoAssist value that job was started with. The autoAssist sent on the repeat is ignored.

Use the intelligems-access-token header. The token selects the organization; do not send orgId. The organization must have Agentic Logic enabled.

Rate Limit: 50 requests per 30s window, refilling 25 tokens every 30s.

Authorizations
intelligems-access-tokenstringRequired

Intelligems external API access token.

Path parameters
ruleIdstring · uuidRequiredPattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Body

Start an async publish job for the rule's current draft. Returns the job handle to poll.

notesstring · min: 1Optional

Publish notes to stamp on the resulting version.

titlestring · min: 1 · max: 255Optional

Display title to stamp on the resulting version. When omitted, chat-origin drafts default to "Built from chat"; manual drafts get no title.

idempotencyKeystring · min: 1Optional

Client-supplied idempotency key. A repeated publish for the same rule and key returns the existing job handle instead of starting another job.

autoAssistbooleanOptional

Whether a failed job starts AI repair. Defaults to true. False leaves a failed job failed: this job opens no repair loop, so it never leads the platform to rewrite or republish the rule's source. A repair loop already running for the rule is not stopped. A successful publish is unaffected. A replay of an existing idempotencyKey returns that job as it was started, whatever this says.

Responses
202

Accepted

application/json
post/v25-10-beta/agentic-logic/rules/{ruleId}/publish
Request
curl --request POST \
  "https://api.intelligems.io/v25-10-beta/agentic-logic/rules/<ruleId>/publish" \
  --header "intelligems-access-token: YOUR_API_KEY" \
  --header "Content-Type: application/json" \
  --data @request.json
{
  "publishJobId": "text"
}

Poll a publish job

get
GET /v25-10-beta/agentic-logic/rules/{ruleId}/publish-jobs/{jobId}

The response is { job }.

  • status is queued, running, succeeded, failed, or cancelled. A cancelled job was stopped by a person and is final.

  • mode is publish (every gate, then a new active version on success) or dry_run (the validation gates only; never promotes). The API starts dry_run jobs through run-gates; the platform also starts them, such as on a code rule's first draft save, in the repair loop, and from "Run tests" in the admin.

  • The response includes every gate with its own status and result, so a failed publish tells you which gate rejected it and why.

  • When a publish job succeeds, resultingVersionId identifies the version that is now active.

Use the intelligems-access-token header. The token selects the organization; do not send orgId. The organization must have Agentic Logic enabled.

Rate Limit: 50 requests per 30s window, refilling 25 tokens every 30s.

Authorizations
intelligems-access-tokenstringRequired

Intelligems external API access token.

Path parameters
ruleIdstring · uuidRequiredPattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
jobIdstring · uuidRequiredPattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Responses
200

OK

application/json
get/v25-10-beta/agentic-logic/rules/{ruleId}/publish-jobs/{jobId}
Request
curl --request GET \
  "https://api.intelligems.io/v25-10-beta/agentic-logic/rules/<ruleId>/publish-jobs/<jobId>" \
  --header "intelligems-access-token: YOUR_API_KEY"
{
  "job": {
    "id": "text",
    "ruleId": "text",
    "status": "queued",
    "mode": "publish",
    "startedAtTs": 1,
    "finishedAtTs": 1,
    "resultingVersionId": "text",
    "gates": [
      {
        "gateKey": "static_contract",
        "status": "pending",
        "result": "text",
        "detailsJson": {
          "ANY_ADDITIONAL_PROPERTY": "anything"
        },
        "startedAtTs": 1,
        "finishedAtTs": 1
      }
    ]
  }
}

Run the gates without publishing

post

Success status: 202 Accepted.

POST /v25-10-beta/agentic-logic/rules/{ruleId}/run-gates

Starts an asynchronous dry run: the full publish gate set against the rule's saved draft (code rules) or template configuration (builder rules), without deploying. It never creates a version and never changes the rule's state, so a paused rule can be checked too.

  • idempotencyKey (string, optional) — Client-supplied key. Replays as on publish, including the autoAssist the job was started with. Keys are shared with publish: a key a publish already used returns that publish job.

  • autoAssist (boolean, optional) — Whether a failed dry run of a code rule starts AI repair. Defaults to true, as on publish. Send false to leave a failed job failed: no repair run opens, so the platform never rewrites the rule's source or republishes it. It does not stop a repair run that is already running. It is frozen into this job only.

The endpoint answers 202 Accepted with { "publishJobId": "..." }. Poll it with Poll a publish job; its mode is dry_run, and a passing dry run ends succeeded with no resultingVersionId.

Use the intelligems-access-token header. The token selects the organization; do not send orgId. The organization must have Agentic Logic enabled.

Rate Limit: 50 requests per 30s window, refilling 25 tokens every 30s.

Authorizations
intelligems-access-tokenstringRequired

Intelligems external API access token.

Path parameters
ruleIdstring · uuidRequiredPattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Body

Start an async dry-run job that evaluates the validation gates against the rule's current draft without publishing a version. Returns the job handle to poll.

idempotencyKeystring · min: 1Optional

Client-supplied idempotency key. A repeated request for the same rule and key returns the existing job handle instead of starting another job; keys are shared with publish.

autoAssistbooleanOptional

Whether a failed dry run starts AI repair. Defaults to true. False leaves a failed job failed: this job opens no repair loop, so it never leads the platform to rewrite or republish the rule's source. A repair loop already running for the rule is not stopped. A replay of an existing idempotencyKey returns that job as it was started, whatever this says.

Responses
202

Accepted

application/json
post/v25-10-beta/agentic-logic/rules/{ruleId}/run-gates
Request
curl --request POST \
  "https://api.intelligems.io/v25-10-beta/agentic-logic/rules/<ruleId>/run-gates" \
  --header "intelligems-access-token: YOUR_API_KEY" \
  --header "Content-Type: application/json" \
  --data @request.json
{
  "publishJobId": "text"
}

List a rule's scenarios

get
GET /v25-10-beta/agentic-logic/rules/{ruleId}/scenarios

Lists the validation scenarios of the rule's saved draft (code rules) or the scenarios its template describes (builder rules).

  • status is ready, or pending when the generated scenarios do not yet cover the draft's current branches. The read never starts generation.

  • branchIds lists the draft's attempt() branch labels, so coverage gaps are visible.

Use the intelligems-access-token header. The token selects the organization; do not send orgId. The organization must have Agentic Logic enabled.

Rate Limit: 50 requests per 30s window, refilling 25 tokens every 30s.

Authorizations
intelligems-access-tokenstringRequired

Intelligems external API access token.

Path parameters
ruleIdstring · uuidRequiredPattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Responses
200

OK

application/json
get/v25-10-beta/agentic-logic/rules/{ruleId}/scenarios
Request
curl --request GET \
  "https://api.intelligems.io/v25-10-beta/agentic-logic/rules/<ruleId>/scenarios" \
  --header "intelligems-access-token: YOUR_API_KEY"
{
  "scenarios": [
    {
      "name": "text",
      "request": {
        "surface": "onsite",
        "placementId": "text",
        "cart": {
          "currency": "text",
          "subtotal": 1,
          "itemCount": 1,
          "lines": [
            {
              "productId": "text",
              "variantId": "text",
              "quantity": 1,
              "unitPrice": 1,
              "lineTotal": 1,
              "selectedOptions": [
                {
                  "name": "text",
                  "value": "text"
                }
              ],
              "isSubscriptionLine": true,
              "flags": {
                "giftCard": true,
                "syntheticGift": true,
                "bundleChild": true,
                "igUpsell": true
              },
              "tags": [
                "text"
              ],
              "collections": [
                "text"
              ]
            }
          ]
        },
        "order": {
          "orderId": "text",
          "checkoutToken": "text",
          "createdAt": "2026-01-01T00:00:00.000Z",
          "currencyCode": "text",
          "presentmentCurrency": "text",
          "itemsSubtotal": 1,
          "discountTotal": 1,
          "shippingTotal": 1,
          "taxTotal": 1,
          "total": 1,
          "lines": [
            {
              "productId": "text",
              "variantId": "text",
              "quantity": 1,
              "unitPrice": 1,
              "lineTotal": 1,
              "selectedOptions": [
                {
                  "name": "text",
                  "value": "text"
                }
              ],
              "isSubscriptionLine": true,
              "flags": {
                "giftCard": true,
                "syntheticGift": true,
                "bundleChild": true,
                "igUpsell": true
              },
              "tags": [
                "text"
              ],
              "collections": [
                "text"
              ],
              "title": "text",
              "vendor": "text",
              "productType": "text",
              "sellingPlanId": "text",
              "discountAllocations": [
                {
                  "amount": 1,
                  "title": "text"
                }
              ]
            }
          ]
        },
        "pageProduct": {
          "productId": "text",
          "handle": "text"
        },
        "customer": {
          "id": "text",
          "ordersCount": 1,
          "amountSpent": {
            "amount": 1,
            "currency": "text"
          }
        },
        "shipping": {
          "state": "resolved",
          "currency": "text",
          "freeShippingThreshold": 1,
          "remainingToFreeShipping": 1,
          "tiers": [
            {
              "threshold": 1,
              "label": "text"
            }
          ],
          "delivery": {
            "isLocalPickup": true,
            "selected": {
              "title": "text",
              "isPickup": true,
              "selected": true,
              "cost": 1,
              "currency": "text",
              "carrierName": "text",
              "transitDays": {
                "min": 1,
                "max": 1
              }
            },
            "options": [
              {
                "title": "text",
                "isPickup": true,
                "selected": true,
                "cost": 1,
                "currency": "text",
                "carrierName": "text",
                "transitDays": {
                  "min": 1,
                  "max": 1
                }
              }
            ]
          }
        },
        "country": "text",
        "cartFingerprint": "text"
      },
      "context": {
        "isPreview": true,
        "slotsNeeded": 1
      },
      "evaluatedAt": 1,
      "description": "text",
      "targetBranchId": "text",
      "origin": "authored"
    }
  ],
  "status": "ready",
  "branchIds": [
    "text"
  ]
}

List published versions

get
GET /v25-10-beta/agentic-logic/rules/{ruleId}/versions

Lists the published versions of a rule, including which one is active.

Use the intelligems-access-token header. The token selects the organization; do not send orgId. The organization must have Agentic Logic enabled.

Rate Limit: 50 requests per 30s window, refilling 25 tokens every 30s.

Authorizations
intelligems-access-tokenstringRequired

Intelligems external API access token.

Path parameters
ruleIdstring · uuidRequiredPattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Responses
200

OK

application/json
get/v25-10-beta/agentic-logic/rules/{ruleId}/versions
Request
curl --request GET \
  "https://api.intelligems.io/v25-10-beta/agentic-logic/rules/<ruleId>/versions" \
  --header "intelligems-access-token: YOUR_API_KEY"
{
  "versions": [
    {
      "id": "text",
      "version": 1,
      "status": "active",
      "notes": "text",
      "title": "text",
      "origin": "chat",
      "settings": {
        "maxItems": 3,
        "excludeOutOfStock": true,
        "excludeItemsInCart": true,
        "excludePdpProduct": true,
        "onEmpty": "hide"
      },
      "templateId": "text",
      "templateVersion": 1,
      "templateParams": {
        "ANY_ADDITIONAL_PROPERTY": "anything"
      },
      "dependencyLockHash": "text",
      "contentFingerprint": "text",
      "shopifyApiVersion": "text",
      "publishedAtTs": 1,
      "publishedByUserId": "text",
      "publishedByUser": {
        "name": "text"
      },
      "createdAtTs": 1
    }
  ]
}

Get a published version

get
GET /v25-10-beta/agentic-logic/rules/{ruleId}/versions/{version}

Gets one published version of a rule by its publish number.

Use the intelligems-access-token header. The token selects the organization; do not send orgId. The organization must have Agentic Logic enabled.

Rate Limit: 50 requests per 30s window, refilling 25 tokens every 30s.

Authorizations
intelligems-access-tokenstringRequired

Intelligems external API access token.

Path parameters
ruleIdstring · uuidRequiredPattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
versionstringRequiredPattern: ^\d+$
Responses
200

OK

application/json
get/v25-10-beta/agentic-logic/rules/{ruleId}/versions/{version}
Request
curl --request GET \
  "https://api.intelligems.io/v25-10-beta/agentic-logic/rules/<ruleId>/versions/<version>" \
  --header "intelligems-access-token: YOUR_API_KEY"
{
  "detail": {
    "version": {
      "id": "text",
      "version": 1,
      "status": "active",
      "notes": "text",
      "title": "text",
      "origin": "chat",
      "settings": {
        "maxItems": 3,
        "excludeOutOfStock": true,
        "excludeItemsInCart": true,
        "excludePdpProduct": true,
        "onEmpty": "hide"
      },
      "templateId": "text",
      "templateVersion": 1,
      "templateParams": {
        "ANY_ADDITIONAL_PROPERTY": "anything"
      },
      "dependencyLockHash": "text",
      "contentFingerprint": "text",
      "shopifyApiVersion": "text",
      "publishedAtTs": 1,
      "publishedByUserId": "text",
      "publishedByUser": {
        "name": "text"
      },
      "createdAtTs": 1
    },
    "sourceUrl": "text",
    "userTestsUrl": "text",
    "generatedTestsUrl": "text",
    "dependencyLock": {
      "ANY_ADDITIONAL_PROPERTY": "text"
    },
    "graph": {
      "version": 1,
      "nodes": [
        {
          "id": "text",
          "kind": "input",
          "label": "text",
          "summary": "text",
          "branchId": "text",
          "meta": {
            "itemCount": 1,
            "sampleItems": [
              "text"
            ],
            "condition": "text",
            "conditionSubject": "cart",
            "sortKey": "text",
            "limit": 1,
            "ANY_ADDITIONAL_PROPERTY": "anything"
          }
        }
      ],
      "edges": [
        {
          "from": "text",
          "to": "text",
          "kind": "flow"
        }
      ]
    }
  }
}

List Sources

get
GET /v25-10-beta/agentic-logic/sources

Lists every Source with its refresh status and the rules whose published versions read it.

Use the intelligems-access-token header. The token selects the organization; do not send orgId. The organization must have Agentic Logic enabled.

Rate Limit: 50 requests per 30s window, refilling 25 tokens every 30s.

Authorizations
intelligems-access-tokenstringRequired

Intelligems external API access token.

Responses
200

OK

application/json
get/v25-10-beta/agentic-logic/sources
Request
curl --request GET \
  "https://api.intelligems.io/v25-10-beta/agentic-logic/sources" \
  --header "intelligems-access-token: YOUR_API_KEY"
{
  "sources": [
    {
      "name": "text",
      "description": "text",
      "definition": {
        "kind": "text",
        "args": {
          "timeWindow": "24h",
          "metric": "units",
          "scope": {
            "collectionIds": [
              "text"
            ],
            "tags": [
              "text"
            ]
          },
          "limit": 1,
          "excludeOutOfStock": true
        }
      },
      "summary": "text",
      "freshMs": 1,
      "freshMsOverride": 1,
      "status": "warming",
      "fetchedAt": 1,
      "lastRefreshedAt": 1,
      "lastRefreshStatus": "ok",
      "lastError": "text",
      "lastBuildLog": "text",
      "lastReadAt": 1,
      "lastUpdateTs": 1,
      "usedBy": [
        {
          "ruleId": "text",
          "ruleName": "text"
        }
      ]
    }
  ]
}

Validate a Source definition

post
POST /v25-10-beta/agentic-logic/sources/validate

Runs the checks a PUT of the definition would run, without storing anything.

  • definition (object, required) — A Source definition, the same shape as the PUT body's definition.

  • The response is { "valid": true, "warnings": [...] } or { "valid": false, "errors": [...], "warnings": [...] }. errors are why a PUT would answer 400; warnings never block a write.

  • Script Sources are checked for the build export, ESM compatibility, the sandbox source guard, and a compilable outputSchema; GraphQL Sources for an input-independent document. Other kinds have no write-time checks.

  • A failed check is a 200 with valid: false; a malformed body is a 400.

Use the intelligems-access-token header. The token selects the organization; do not send orgId. The organization must have Agentic Logic enabled.

Rate Limit: 50 requests per 30s window, refilling 25 tokens every 30s.

Authorizations
intelligems-access-tokenstringRequired

Intelligems external API access token.

Body
definitionone ofRequired

The SDK read a Source names, restricted to reads whose answer does not depend on the request: best sellers, new arrivals, in stock, one collection page, a stored GraphQL query (storefrontGraphql: $country: CountryCode! + @inContext(country: $country), country never stored; adminGraphql: catalog/content root fields only, no customer, order or cost fields), or a script (one source.ts exporting async function build(sdk) that the platform runs on a schedule in a sandbox; its JSON return value, up to 1 MiB, is the Source's answer, read with sdk.getSourceRaw). A GraphQL Source stores ALL of its variables. A typed or GraphQL Source's answer shares the read-cache entry of the equivalent direct SDK read; a script's value has its own entry.

or
or
or
or
or
or
Responses
200

OK

application/json
Responseone of
or
post/v25-10-beta/agentic-logic/sources/validate
Request
curl --request POST \
  "https://api.intelligems.io/v25-10-beta/agentic-logic/sources/validate" \
  --header "intelligems-access-token: YOUR_API_KEY" \
  --header "Content-Type: application/json" \
  --data @request.json
{
  "valid": true,
  "warnings": [
    "text"
  ]
}

Get a Source

get
GET /v25-10-beta/agentic-logic/sources/{name}

Gets one Source. includeCache=true also returns cachedOutputs, the cached answer per market, without starting a read or a refresh.

Use the intelligems-access-token header. The token selects the organization; do not send orgId. The organization must have Agentic Logic enabled.

Rate Limit: 50 requests per 30s window, refilling 25 tokens every 30s.

Authorizations
intelligems-access-tokenstringRequired

Intelligems external API access token.

Path parameters
namestring · max: 128RequiredPattern: ^[a-z][a-z0-9-]*$
Query parameters
includeCachestring · enumOptionalPossible values:
Responses
200

OK

application/json
get/v25-10-beta/agentic-logic/sources/{name}
Request
curl --request GET \
  "https://api.intelligems.io/v25-10-beta/agentic-logic/sources/<name>" \
  --header "intelligems-access-token: YOUR_API_KEY"
{
  "source": {
    "name": "text",
    "description": "text",
    "definition": {
      "kind": "text",
      "args": {
        "timeWindow": "24h",
        "metric": "units",
        "scope": {
          "collectionIds": [
            "text"
          ],
          "tags": [
            "text"
          ]
        },
        "limit": 1,
        "excludeOutOfStock": true
      }
    },
    "summary": "text",
    "freshMs": 1,
    "freshMsOverride": 1,
    "status": "warming",
    "fetchedAt": 1,
    "lastRefreshedAt": 1,
    "lastRefreshStatus": "ok",
    "lastError": "text",
    "lastBuildLog": "text",
    "lastReadAt": 1,
    "lastUpdateTs": 1
  },
  "cachedOutputs": [
    {
      "market": "text",
      "entry": {
        "fetchedAt": 1,
        "value": null
      }
    }
  ]
}

Create or replace a Source

put
PUT /v25-10-beta/agentic-logic/sources/{name}

Creates the Source or replaces it in place, and takes effect immediately.

  • description (string, required) — What the Source reads, for authors.

  • definition (object, required) — What the Source reads.

  • freshMsOverride (number, optional) — Freshness override, within the read kind's allowed range. Omit to use the kind's default.

A new Source, or one whose definition or freshness changed, gets an immediate first refresh after the write commits. The response carries warnings the author should reconsider.

Use the intelligems-access-token header. The token selects the organization; do not send orgId. The organization must have Agentic Logic enabled.

Rate Limit: 50 requests per 30s window, refilling 25 tokens every 30s.

Authorizations
intelligems-access-tokenstringRequired

Intelligems external API access token.

Path parameters
namestring · max: 128RequiredPattern: ^[a-z][a-z0-9-]*$
Body
descriptionstring · min: 1 · max: 2048Required

What the Source reads and what rules use it for — the text an agent reads to judge reuse.

definitionone ofRequired

The typed read the Source names.

or
or
or
or
or
or
freshMsOverrideinteger · min: 60000 · max: 9007199254740991Optional
Responses
200

OK

application/json
put/v25-10-beta/agentic-logic/sources/{name}
Request
curl --request PUT \
  "https://api.intelligems.io/v25-10-beta/agentic-logic/sources/<name>" \
  --header "intelligems-access-token: YOUR_API_KEY" \
  --header "Content-Type: application/json" \
  --data @request.json
{
  "source": {
    "name": "text",
    "description": "text",
    "definition": {
      "kind": "text",
      "args": {
        "timeWindow": "24h",
        "metric": "units",
        "scope": {
          "collectionIds": [
            "text"
          ],
          "tags": [
            "text"
          ]
        },
        "limit": 1,
        "excludeOutOfStock": true
      }
    },
    "summary": "text",
    "freshMs": 1,
    "freshMsOverride": 1,
    "status": "warming",
    "fetchedAt": 1,
    "lastRefreshedAt": 1,
    "lastRefreshStatus": "ok",
    "lastError": "text",
    "lastBuildLog": "text",
    "lastReadAt": 1,
    "lastUpdateTs": 1
  },
  "warnings": [
    "text"
  ]
}

Delete a Source

delete
DELETE /v25-10-beta/agentic-logic/sources/{name}

Deletes a Source. A Source read by any rule's active version answers 409 and names those rules.

Use the intelligems-access-token header. The token selects the organization; do not send orgId. The organization must have Agentic Logic enabled.

Rate Limit: 50 requests per 30s window, refilling 25 tokens every 30s.

Authorizations
intelligems-access-tokenstringRequired

Intelligems external API access token.

Path parameters
namestring · max: 128RequiredPattern: ^[a-z][a-z0-9-]*$
Responses
200

OK

application/json
Responseobject
delete/v25-10-beta/agentic-logic/sources/{name}
Request
curl --request DELETE \
  "https://api.intelligems.io/v25-10-beta/agentic-logic/sources/<name>" \
  --header "intelligems-access-token: YOUR_API_KEY"
{}

Refresh a Source

post
POST /v25-10-beta/agentic-logic/sources/{name}/refresh

Queues a refresh of the Source's cached data. It spends the shop's Admin API read budget, so it is refused (with a reason) while the budget has no headroom, during a per-Source cooldown, or when a refresh is already in flight.

Use the intelligems-access-token header. The token selects the organization; do not send orgId. The organization must have Agentic Logic enabled.

Rate Limit: 50 requests per 30s window, refilling 25 tokens every 30s.

Authorizations
intelligems-access-tokenstringRequired

Intelligems external API access token.

Path parameters
namestring · max: 128RequiredPattern: ^[a-z][a-z0-9-]*$
Responses
200

OK

application/json
Responseone of
or
post/v25-10-beta/agentic-logic/sources/{name}/refresh
Request
curl --request POST \
  "https://api.intelligems.io/v25-10-beta/agentic-logic/sources/<name>/refresh" \
  --header "intelligems-access-token: YOUR_API_KEY"
{
  "source": {
    "name": "text",
    "description": "text",
    "definition": {
      "kind": "text",
      "args": {
        "timeWindow": "24h",
        "metric": "units",
        "scope": {
          "collectionIds": [
            "text"
          ],
          "tags": [
            "text"
          ]
        },
        "limit": 1,
        "excludeOutOfStock": true
      }
    },
    "summary": "text",
    "freshMs": 1,
    "freshMsOverride": 1,
    "status": "warming",
    "fetchedAt": 1,
    "lastRefreshedAt": 1,
    "lastRefreshStatus": "ok",
    "lastError": "text",
    "lastBuildLog": "text",
    "lastReadAt": 1,
    "lastUpdateTs": 1
  },
  "queued": true
}

System rules

put
PUT /v25-10-beta/agentic-logic/system-rules/{systemKey}

Ensures the store's built-in rule for systemKey exists. Idempotent: the first call creates the rule and enqueues its first publish; every later call returns the same rule unchanged. The response carries rule and latestPublishJob, which tells a still-draft rule's first version being on its way from having failed.

Use the intelligems-access-token header. The token selects the organization; do not send orgId. The organization must have Agentic Logic enabled.

Rate Limit: 50 requests per 30s window, refilling 25 tokens every 30s.

Authorizations
intelligems-access-tokenstringRequired

Intelligems external API access token.

Path parameters
systemKeystring · enumRequired

Which built-in rule to ensure. The call is idempotent: the first call for a store creates the rule and enqueues its first publish, and every later call returns the same rule.

Possible values:
Responses
200

OK

application/json
put/v25-10-beta/agentic-logic/system-rules/{systemKey}
Request
curl --request PUT \
  "https://api.intelligems.io/v25-10-beta/agentic-logic/system-rules/<systemKey>" \
  --header "intelligems-access-token: YOUR_API_KEY"
{
  "rule": {
    "id": "text",
    "organizationId": "text",
    "name": "text",
    "description": "text",
    "managedBy": "builder",
    "state": "draft",
    "templateId": "text",
    "templateParams": {
      "ANY_ADDITIONAL_PROPERTY": "anything"
    },
    "templateVersion": 1,
    "targetSurfaces": [
      "onsite"
    ],
    "settings": {
      "maxItems": 3,
      "excludeOutOfStock": true,
      "excludeItemsInCart": true,
      "excludePdpProduct": true,
      "onEmpty": "hide"
    },
    "authoringSessionId": "text",
    "systemKey": "shopify-recommendations",
    "createdAtTs": 1,
    "lastUpdateTs": 1
  },
  "latestPublishJob": {
    "id": "text",
    "ruleId": "text",
    "status": "queued",
    "mode": "publish",
    "startedAtTs": 1,
    "finishedAtTs": 1,
    "resultingVersionId": "text",
    "gates": [
      {
        "gateKey": "static_contract",
        "status": "pending",
        "result": "text",
        "detailsJson": {
          "ANY_ADDITIONAL_PROPERTY": "anything"
        },
        "startedAtTs": 1,
        "finishedAtTs": 1
      }
    ]
  }
}

Last updated

Was this helpful?