> ## Documentation Index
> Fetch the complete documentation index at: https://docs.subtotal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Set Simulated Status

> Set one of your simulated connections to `active` or `unauthenticated` and emit the matching connection event to your webhooks, marked `is_simulated`. Setting the status it already has emits the event again.

[Subtotal Connector tool: set\_simulated\_status](/docs/connector/tools.md#set_simulated_status)

Sets one of your simulated connections to `active` or `unauthenticated` and sends `connection.activated` or `connection.unauthenticated` to webhook destinations that [accept simulated events](/docs/event-simulator.md#configure-simulated-events-for-your-webhook-destination). Use it to test how your integration handles a shopper losing and regaining their retailer login. Setting the status it already has sends the event again.

Other statuses return `422`. Real connections never change: a real, deleted or unknown connection returns `404`.

Call it with your API key, or with a [Subtotal Connector](/docs/connector/introduction.md) OAuth token that includes `simulator:write`. A token without it receives `403 insufficient_scope`. [Partner app](/docs/partner-apps/introduction.md#fixed-permissions) tokens don't include it.


## OpenAPI

````yaml patch /simulated-connections/{connection_id}
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers: []
security: []
paths:
  /simulated-connections/{connection_id}:
    patch:
      tags:
        - simulator
      summary: Set Simulated Status
      description: >-
        Set one of your simulated connections to `active` or `unauthenticated`
        and emit the matching connection event to your webhooks, marked
        `is_simulated`. Setting the status it already has emits the event again.
      operationId: set_simulated_status_simulated_connections__connection_id__patch
      parameters:
        - name: connection_id
          in: path
          required: true
          schema:
            type: string
            title: Connection Id
        - name: authorization
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Authorization
        - name: x-api-key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Api-Key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SetSimulatedStatusRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConnectionResponse'
        '404':
          description: No simulated connection of yours with this id
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    SetSimulatedStatusRequest:
      properties:
        status:
          $ref: '#/components/schemas/SimulatedStatus'
          description: >-
            `unauthenticated` emits `connection.unauthenticated`, as when a
            consumer's retailer login expires; `active` emits
            `connection.activated`, as when they reconnect
          examples:
            - unauthenticated
      type: object
      required:
        - status
      title: SetSimulatedStatusRequest
    ConnectionResponse:
      properties:
        connection_id:
          type: string
          title: Connection Id
          description: A unique identifier for the connection
          examples:
            - 01J51S0JYV6N7K1030CV1ZKSCA
        customer_id:
          type: string
          title: Customer Id
          description: >-
            A unique identifier used to map connections to customer records in
            external systems.
          examples:
            - 8a46e581-48ba-498a-9ad0-2ee72582e1af
        retailer_id:
          type: string
          title: Retailer Id
          description: The unique identifier for the retailer in the connection
          examples:
            - 01J7SC0NN73R6F5VVSP3ZKPDA3
        status:
          $ref: '#/components/schemas/ConnectionStatusResponse'
          description: The status of the connection
          examples:
            - active
        email:
          anyOf:
            - type: string
            - type: 'null'
          title: Email
          description: The customer's email address
          examples:
            - alice@example.com
        mobile:
          anyOf:
            - type: string
            - type: 'null'
          title: Mobile
          description: The customer's mobile phone number
          examples:
            - '+1234567890'
        creation_date:
          type: string
          format: date-time
          title: Creation Date
          description: When the connection was created
          examples:
            - '2024-08-13T17:27:57.913Z'
        tags:
          additionalProperties:
            type: string
          type: object
          title: Tags
          description: >-
            Client-defined attribution tags recorded when the connection is
            created, for grouping connection metrics — e.g. {"campaign":
            "summer_sweeps", "program": "loyalty"}. Names and values are opaque
            to Subtotal and are never interpreted. At most 10 tags; names up to
            64 characters, values up to 256. Intended for campaign and source
            metadata — do not put consumer PII in tags.
          examples:
            - campaign: summer_sweeps
        is_simulated:
          type: boolean
          title: Is Simulated
          description: >-
            True for a test connection made with the event simulator. Its events
            are marked is_simulated too, and it never collects real purchases.
          default: false
          examples:
            - false
      type: object
      required:
        - connection_id
        - customer_id
        - retailer_id
        - status
        - email
        - mobile
        - creation_date
      title: ConnectionResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SimulatedStatus:
      type: string
      enum:
        - active
        - unauthenticated
      title: SimulatedStatus
      description: >-
        The statuses a simulated connection can be set to; each emits its
        connection event.
    ConnectionStatusResponse:
      type: string
      enum:
        - active
        - initialized
        - unauthenticated
        - disconnected
      title: ConnectionStatusResponse
      description: >-
        Connection status enum for API responses (excludes revoked status).

        NOTE: This should mirror the ConnectionStatus enum the database,
        excluding internal statuses like (REVOKED)
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.