Shopper Agents

POST Initializes an Agentforce session.

POST /organizations/{organizationId}/session/init

Operation ID: postSessionInit. Security: ShopperToken (sfcc.shopper-agents.rw); ShopperClientContextToken (sfcc.shopper-agents.rw).

The request body must include the sessionInitKey field. Missing or invalid sessionInitKey information results in INVALID_REQUEST_PARAMETERS (400).

Parameters

  • organizationId (path, OrganizationId, required) An identifier for the Salesforce Commerce Cloud organization the request is being made by. It consists of a prefix 'f_ecom_' followed by a 4-character realm identifier and a 3-character instance type identifier.

    Example

    f_ecom_zzxy_prd
  • siteId (query, SiteId, required) The identifier of the site that a request is being made in the context of. Attributes might have site specific values, and some objects may only be assigned to specific sites.

    Example: SiteId

    RefArch
  • sfdc_usid (header, string (uuid)) A unique shopper identifier (USID) for tracking client context. Used with endpoints secured with ShopperClientContextToken. This header is required for all endpoints secured with ShopperClientContextToken.
    Example: 550e8400-e29b-41d4-a716-446655440000.
  • sfdc_shopper_context (header, string) Shopper context information (for example clientIP, sourceCode, and customQualifiers) passed in from a trusted backend application.

Request body (required)

Media type: application/json. Schema: SessionInitRequest.

Example: ShopperAgentsSessionInitRequest

{
  "sessionInitKey": "aPrx.0rn0R1k7G.PtUUXh6S90_rMvqsYhpDZlNpyYsLsTm8KYLodM3flsRBbCD"
}

Responses

  • 202 Accepted (initialization successful; no response body)
  • 400 Validation Error

    Media type: application/problem+json. Schema: ErrorResponse.

    Example: ValidationError

    {
      "title": "Validation Error",
      "type": "https://api.commercecloud.salesforce.com/documentation/error/v1/errors/validation",
      "detail": "Unable to validate post body."
    }
  • 401 Unauthorized (invalid or expired token)

    Media type: application/problem+json. Schema: ErrorResponse.

    Example: Unauthorized

    {
      "title": "Invalid Basic Authentication",
      "type": "https://api.commercecloud.salesforce.com/documentation/error/v1/errors/unauthorized",
      "detail": "Your access token is invalid or expired and can’t be used to identify a user."
    }
  • 500 Unexpected server-side exception during SLAS authentication

    Media type: application/problem+json. Schema: ErrorResponse.

    Example: ReadError

    {
      "title": "Internal Server Error",
      "type": "https://api.commercecloud.salesforce.com/documentation/error/v1/errors/internal-server-error",
      "detail": "Unexpected server-side exception during SLAS authentication."
    }