Skip to content

Endpoint Simulators

Endpoint Simulators lets customers simulate endpoints to test out their flows and integrations.

Use endpoint simulators whenever you want to make sure that things work before you buy real devices.

For example, if a customer wants to control a lightbulb and make sure that it will work with Port OS's lightbulb integration, they can use an endpoint simulator for a lightbulb to see how the experience looks.

Create or update a simulator

View source specification ↗
POST /endpoint-simulators

Creates a new endpoint simulator or updates an existing one. When an id is provided in the request body, the simulator with that ID is updated. When no id is provided, a new simulator is created along with its associated endpoint, auth link, and route. Requires a signed user/session or the existing authenticated client flow. The anonymous DCR delegated device profile cannot invoke this operation.

Required scope

Any authenticated access token

Header parameters

Idempotency-KeystringRequired

Client-chosen key that makes a non-idempotent request retry-safe, following draft-ietf-httpapi-idempotency-key-header. A committed response is stored for 24 hours and replayed for the same principal, operation, key and payload. Missing key returns 400 IDEMPOTENCY_KEY_REQUIRED, a key longer than 255 characters returns 400 IDEMPOTENCY_KEY_INVALID, the same key with a different payload returns 422, and the same key while the first request is still in flight returns 409. Requests rolled back before external provider attempts do not consume the key. Group mutations retain terminal failed responses after provider attempts together with received provider truth; their operation contract defines these replayable outcomes.

minLength: 1

maxLength: 255

If-Matchstring

Required for a full replacement when the request identifies an existing resource. Send that resource's quoted strong etag from its last GET. A missing condition on a replacement returns 428 PRECONDITION_REQUIRED; a stale condition returns 412 PRECONDITION_FAILED. Omit this header when creating a new resource without an id. Wildcards are accepted only where the operation explicitly permits them.

minLength: 1

Request body

Required

Fields

idstring

Existing simulator ID to replace; omitted on create. An unknown ID returns 404.

pattern: "^port1/[^/]+/[^/]+/endpoint-simulators/[^/]+$"

nameTypeValueRequired
device_typestringRequired

The type of device being simulated

configurationSimulatorConfiguration

Typed simulator producer settings. Omitted camera profile advertises motion/person; doorbell adds chime. Profile must be compatible with device_type. Rooms are valid only for a VACUUM or LIGHTING_HUB simulator; an omitted list gives a vacuum Living room, Kitchen, Bedroom and Hallway; a LIGHTING_HUB must list them.

Returns

200

Simulator stored successfully. The response is retained for replay for 24 hours.

Fields
(payload)any

An endpoint simulator.

Response headers
ETagstring

Opaque strong entity tag of the returned resource version. Send it back in `If-Match` on the next mutation of the same resource.

Errors

400 IDEMPOTENCY_KEY_REQUIRED

Invalid request payload

Check the request fields and any validation details, then correct the payload.

401 UNAUTHORIZED

Unauthorized - invalid or missing authentication token

Obtain a valid access token, then retry.

403 FORBIDDEN

Forbidden - insufficient permissions

Check the linked account and its permissions for the device or resource.

404 NOT_FOUND

The named simulator does not exist.

Verify the target identifier and that its endpoint or plugin route still exists.

409 IDEMPOTENCY_KEY_IN_FLIGHT

Idempotency key in flight.

Check the device’s current mode or state. Retry only after the conflict is resolved.

412 PRECONDITION_FAILED

Stale If-Match.

Inspect the returned code and family and follow the error handling guide.

415 UNSUPPORTED_MEDIA_TYPE

Unsupported request media type.

Inspect the returned code and family and follow the error handling guide.

422 IDEMPOTENCY_KEY_REUSED

Idempotency key payload conflict.

Correct the rejected value using the constraints in the error details or request schema.

428 PRECONDITION_REQUIRED

Missing If-Match on replace.

Inspect the returned code and family and follow the error handling guide.

500 INTERNAL

Internal server error

Retry with backoff only when the operation is safe to repeat. Include the error code when reporting persistent failures.

List all simulators

View source specification ↗
GET /endpoint-simulators

Lists endpoint simulators for the authenticated user. Supports pagination via maxResults and nextToken query parameters. When owner is not specified, defaults to the authenticated caller. Requires a signed user/session or the existing authenticated client flow. The anonymous DCR delegated device profile cannot invoke this operation.

Required scope

Any authenticated access token

Query parameters

ownerstring

Filter the results by the owner of the resource. Defaults to the authenticated caller's resources when omitted. Use '~caller' to make that scope explicit. Another owner can be selected only for resources the caller can read.

maxResultsinteger

The maximum number of results to return

minimum: 1

maximum: 100

nextTokenstring

Opaque token for the next page of results. Pass the continuation token returned by the previous response, unchanged. Omit it to start from the first page.

expandarray<string>

Expansion tokens that request related or computed fields for each result. When omitted, the response contains only the default, shallower set of fields for each result.

Returns

200

Simulators retrieved successfully

Fields
resultsarray<Simulator>Required

List of simulators

An endpoint simulator.

nameTypeValueRequired
etagstringRequired

Strong version of simulator name, device type and configuration. Observed state does not advance this version.

stateobject

Current observed simulated-device state. Updated by the simulator provider, independently of the writable configuration version.

idstringRequired

The unique identifier for the simulator

pattern: "^port1/[^/]+/[^/]+/endpoint-simulators/[^/]+$"

associatedEndpointIdstring

The ID of the endpoint that the simulator is associated with

associatedAuthLinkIdstring

The ID of the auth link that the simulator is associated with

associatedRouteIdstring

The ID of the route that the simulator is associated with

created_atstring

The timestamp when the simulator was created

format: "date-time"

updated_atstring

The timestamp when the simulator was last updated

format: "date-time"

device_typestringRequired

The type of device being simulated

configurationSimulatorConfiguration

Typed simulator producer settings. Omitted camera profile advertises motion/person; doorbell adds chime. Profile must be compatible with device_type. Rooms are valid only for a VACUUM or LIGHTING_HUB simulator; an omitted list gives a vacuum Living room, Kitchen, Bedroom and Hallway; a LIGHTING_HUB must list them.

paginationContextPaginationContext
errorsarray<Error>

Partial query errors collected while returning available results.

The one Port OS error shape, returned by every REST error response and every MCP tool error. `code` names the specific failure and `family` its broad class; both are closed enums, so clients branch on them and show `message`, which says what failed and what to do next.

familystringRequired

The broad class of an error. The family decides the HTTP status of a REST error, so clients can handle every code of a family alike.

codestringRequired

The specific error, one of a closed set of Port OS codes. Every REST error body, MCP tool error, batch item error and discovery item error uses this enum; each code belongs to an `ErrorFamily` that decides its HTTP status. Provider-specific codes are never codes: they travel in `details.providerCode`. New failure kinds are added here, never as free strings.

messagestringRequired

Plain-language description of the failure and the suggested next action.

detailsErrorDetails

Optional typed context for an error. Fields are additive and only populated when the error can safely expose that context to API clients.

errorsarray<SynchronizationItemError>

Every rejected item when a request that is validated item by item and applied atomically fails, such as a discovery `SynchronizationRequest` whose routes, group routes or relationships are rejected. Omitted for single-item failures.

One rejected discovery item of a `SynchronizationRequest`, keyed by the plugin-owned identity of the rejected item: `pluginRouteId` for a route or group route, or `relationshipExternalId` for a relationship. Exactly one of the two is set. It shares the `code`, `family`, `status` and `message` fields of `BatchItemError`; discovery items are keyed by plugin-owned identity because they carry no `requestId`. A request with any rejected item is rejected as a whole and lists every rejected item.

pluginRouteIdstring

Plugin-owned identifier of the rejected route or group route. Set unless the item is a relationship.

relationshipExternalIdstring

Plugin-owned `externalId` of the rejected relationship. Set only for relationship items.

interfacestring

Canonical capability interface name the failure applies to, when the failure is interface-specific.

versionstring

Declared capability interface version the failure applies to, when the failure is interface-specific.

codestringRequired

The specific error, one of a closed set of Port OS codes. Every REST error body, MCP tool error, batch item error and discovery item error uses this enum; each code belongs to an `ErrorFamily` that decides its HTTP status. Provider-specific codes are never codes: they travel in `details.providerCode`. New failure kinds are added here, never as free strings.

familystringRequired

The broad class of an error. The family decides the HTTP status of a REST error, so clients can handle every code of a family alike.

statusintegerRequired

HTTP-equivalent status code of the item failure.

minimum: 400

maximum: 599

messagestringRequired

Plain-language description of the failure and the suggested fix.

Errors

400 BAD_REQUEST

Invalid request parameters

Check the request fields and any validation details, then correct the payload.

401 UNAUTHORIZED

Unauthorized - invalid or missing authentication token

Obtain a valid access token, then retry.

403 FORBIDDEN

Forbidden - insufficient permissions

Check the linked account and its permissions for the device or resource.

500 INTERNAL

Internal server error

Retry with backoff only when the operation is safe to repeat. Include the error code when reporting persistent failures.

Get Simulator

View source specification ↗
GET /endpoint-simulators/{id}

Read one simulator with its persisted writable-document etag and observed associations.

Required scope

Any authenticated access token

Path parameters

idstringRequired

URL-encoded complete simulator identifier. A retained legacy identifier addresses only its exact stored simulator row.

pattern: "^(?:port1/[a-z][a-z0-9]*(?:-[a-z0-9]+)*/[A-Za-z0-9][A-Za-z0-9._@+=:~-]{0,254}/endpoint-simulators/[A-Za-z0-9][A-Za-z0-9._@+=:~-]{0,254}|port1\\.simulator\\.[A-Za-z0-9][A-Za-z0-9._@+=:~-]{0,254})$"

Returns

200

Simulator retrieved.

Fields
(payload)any

An endpoint simulator.

Response headers
ETagstring

Opaque strong entity tag of the returned resource version. Send it back in `If-Match` on the next mutation of the same resource.

Errors

404 NOT_FOUND

Simulator not found.

Verify the target identifier and that its endpoint or plugin route still exists.

Delete Simulator

View source specification ↗
DELETE /endpoint-simulators/{id}

Deletes the simulator and its associations atomically. Receipts are retained for 24 hours.

Required scope

Any authenticated access token

Path parameters

idstringRequired

URL-encoded complete simulator identifier. A retained legacy identifier addresses only its exact stored simulator row.

pattern: "^(?:port1/[a-z][a-z0-9]*(?:-[a-z0-9]+)*/[A-Za-z0-9][A-Za-z0-9._@+=:~-]{0,254}/endpoint-simulators/[A-Za-z0-9][A-Za-z0-9._@+=:~-]{0,254}|port1\\.simulator\\.[A-Za-z0-9][A-Za-z0-9._@+=:~-]{0,254})$"

Header parameters

Idempotency-KeystringRequired

Client-chosen key that makes a non-idempotent request retry-safe, following draft-ietf-httpapi-idempotency-key-header. A committed response is stored for 24 hours and replayed for the same principal, operation, key and payload. Missing key returns 400 IDEMPOTENCY_KEY_REQUIRED, a key longer than 255 characters returns 400 IDEMPOTENCY_KEY_INVALID, the same key with a different payload returns 422, and the same key while the first request is still in flight returns 409. Requests rolled back before external provider attempts do not consume the key. Group mutations retain terminal failed responses after provider attempts together with received provider truth; their operation contract defines these replayable outcomes.

minLength: 1

maxLength: 255

If-MatchstringRequired

The quoted strong entity tag of the resource the client last read (its `etag` field or `ETag` response header). The mutation is applied only when it still matches: a stale value returns 412 PRECONDITION_FAILED and a missing header returns 428 PRECONDITION_REQUIRED. Wildcards are accepted only where the operation explicitly permits them.

minLength: 1

Returns

200

Simulator deleted.

No response body.

Errors

400 IDEMPOTENCY_KEY_REQUIRED

Missing or invalid key, or a DELETE body was supplied.

Check the request fields and any validation details, then correct the payload.

404 NOT_FOUND

Simulator not found.

Verify the target identifier and that its endpoint or plugin route still exists.

409 IDEMPOTENCY_KEY_IN_FLIGHT

Idempotency key in flight.

Check the device’s current mode or state. Retry only after the conflict is resolved.

412 PRECONDITION_FAILED

Stale If-Match.

Inspect the returned code and family and follow the error handling guide.

422 IDEMPOTENCY_KEY_REUSED

Idempotency key payload conflict.

Correct the rejected value using the constraints in the error details or request schema.

428 PRECONDITION_REQUIRED

Missing If-Match.

Inspect the returned code and family and follow the error handling guide.