Integrations API

Report lifecycle events for remote delegation sessions.

POST/api/remote-delegations/events

Report a remote delegation lifecycle event

Reports one event of a remote delegation session, sent by the machine running the session with the `surface` and `delegationId` the delegation was started with. Only the principal that owns the delegation can report its events (403), a delegation that does not exist answers 404, and an event from a session a newer session has replaced answers 409. A droid message reaches a surface only when its `role` is `assistant` and its `visibility` is not `user_only`; any other accepted droid message answers 200 without reaching one. Code channel diff content is limited to 1,000,000 UTF-8 bytes, and a code channel diff whose request body is larger than 2,000,000 UTF-8 bytes answers 400. In an otherwise valid user message event, `text` of 20,001 characters outside the Basic Multilingual Plane, such as most emoji, is 40,002 UTF-16 code units and answers 400, though the request body's `maxLength` of 40,000 counts characters and admits it. In an otherwise valid pull request event, the `url` values `https://example.com/a b`, `https://例子.测试`, `https://example.com/é` and `https://example.com/` followed by U+0001 answer 200, though the request body's `format: uri` refuses them, and `https://` answers 400, though `format: uri` admits it: the handler checks `url` with the WHATWG URL parser. A code channel diff's `repository.url` is checked by the same parser. In an otherwise valid user message event, a `mentions` value with an entry whose `userId` is empty, with more than 20 entries, or that is not an array, each of which the request body refuses, answers 200, and the event is forwarded without `mentions`.

cURL
curl -X POST 'https://api.factory.ai/api/remote-delegations/events' \
  -H "Authorization: Bearer $FACTORY_BEARER_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{ ... }'

Parameters

X-Factory-Org-Idstringheaderoptional

Organization a JWT request acts in; required to act in a sub-organization. Without it, the request acts in the user's root organization, or is rejected with 403 when the user cannot access the root organization. API keys always act in their own organization and ignore this header.

Request body

Required

application/json

No additional properties

surfacestringrequired

Allowed values

appdroid-apijiralinearslackmicrosoft-teamsgoogle-chat
delegationIdstringrequired

Minimum length: 1

sessionIdstringrequired

Minimum length: 1

eventobjectrequired
variantsession-started

No additional properties

kindstringrequired

Allowed values

session-started
variantdroid-message

No additional properties

kindstringrequired

Allowed values

droid-message
messageobjectrequired
idstringrequired
createdAtnumberrequired

Unix timestamp, in milliseconds, when the message was created, as a finite number.

Minimum: -1.7976931348623157e+308

Maximum: 1.7976931348623157e+308

variantdroid-status

No additional properties

kindstringrequired

Allowed values

droid-status
statusstringrequired

Allowed values

idlependingrunning
variantcode-channel-diff

No additional properties

kindstringrequired

Allowed values

code-channel-diff
configurationIdstring <uuid>required
channelIdstringrequired

Minimum length: 1

Maximum length: 128

repositoryobject

No additional properties

namestringrequired

Minimum length: 1

Maximum length: 128

urlstring <uri>

Maximum length: 2048

branchstring

Minimum length: 1

Maximum length: 128

snapshotobjectrequired
variantOption 1 · object

No additional properties

statusstringrequired

Allowed values

ready
contentstringrequired

Minimum length: 1

Maximum length: 1000000

baseBranchstringrequired

Maximum length: 255

headBranchstring

Maximum length: 255

variantOption 2 · object

No additional properties

statusstringrequired

Allowed values

emptyunavailableincompletestaleblocked
variantturn-failed

No additional properties

kindstringrequired

Allowed values

turn-failed
reasonstringrequired

Allowed values

completedcancelledpermission_rejectederrorprocess_exitspec_handoffstructured_output_missingstructured_output_invalidstructured_output_schema_invalidmodel_usage_exhaustedmodel_authentication_failedmodel_request_rejectedmodel_provider_unreachablemodel_provider_unavailablemodel_rate_limitedprompt_rejectedcompletion_persistence_failedno_approver_availablehost_resources_exhausted
userMessageSourcestring

Allowed values

webdesktopcli_tuicli_execcli_acpslackjiralinearmicrosoft-teamsgoogle-chatsessions_apiapisdkautomationreadiness-remediationreadiness-evaluationwiki-generationwiki-ci-setup
variantpull-request-created

No additional properties

kindstringrequired

Allowed values

pull-request-created
urlstring <uri>required

Maximum length: 2048

variantuser-message

No additional properties

kindstringrequired

Allowed values

user-message
messageIdstringrequired

Minimum length: 1

Maximum length: 256

textstringrequired

Maximum length: 40000

authorobject

No additional properties

userIdstringrequired

Minimum length: 1

Maximum length: 256

namestring

Maximum length: 256

mentionsobject[]

Maximum items: 20

Array items

No additional properties

userIdstringrequired

Minimum length: 1

Maximum length: 256

namestringrequired

Minimum length: 1

Maximum length: 256

attachmentsobject[]

Maximum items: 50

Array items

No additional properties

typestringrequired

Allowed values

imagefile
namestring

Maximum length: 512

mediaTypestring

Maximum length: 255

Responses

200Response for status 200

application/json

successbooleanrequired

Allowed values

true
diffDeliveryobject

Returned only for a code channel diff event. A diff that could not be delivered is reported here, inside the 200 response, rather than as an error.

deliveredbooleanrequired
retryAfterMsnumber

Milliseconds to wait before sending the next diff.

surfaceSyncOnboolean

Returned for a `running` droid status event when the delegation's surface mirrors prompts typed in the app: whether surface sync is on for the session. Absent when the backend cannot read the setting.

400Response for status 400

application/json

detailstringrequired

Human-readable error message

statusnumberrequired

HTTP status code

titlestringrequired

HTTP status title

metadataobject (map)

Additional error metadata

Values

object
requestIdstring

Request identifier to include when contacting support

codestring

Stable machine-readable error code, when one applies

displayToUserboolean

True when detail is curated copy that is safe to show users

errorobject

The same error fields, for clients that only read body.error

detailstringrequired

Human-readable error message

statusnumberrequired

HTTP status code

titlestringrequired

HTTP status title

metadataobject (map)

Additional error metadata

Values

object
requestIdstring

Request identifier to include when contacting support

codestring

Stable machine-readable error code, when one applies

displayToUserboolean

True when detail is curated copy that is safe to show users

401Response for status 401

application/json

detailstringrequired

Human-readable error message

statusnumberrequired

HTTP status code

titlestringrequired

HTTP status title

metadataobject (map)

Additional error metadata

Values

object
requestIdstring

Request identifier to include when contacting support

codestring

Stable machine-readable error code, when one applies

displayToUserboolean

True when detail is curated copy that is safe to show users

errorobject

The same error fields, for clients that only read body.error

detailstringrequired

Human-readable error message

statusnumberrequired

HTTP status code

titlestringrequired

HTTP status title

metadataobject (map)

Additional error metadata

Values

object
requestIdstring

Request identifier to include when contacting support

codestring

Stable machine-readable error code, when one applies

displayToUserboolean

True when detail is curated copy that is safe to show users

402Response for status 402

application/json

detailstringrequired

Human-readable error message

statusnumberrequired

HTTP status code

titlestringrequired

HTTP status title

metadataobject (map)

Additional error metadata

Values

object
requestIdstring

Request identifier to include when contacting support

codestring

Stable machine-readable error code, when one applies

displayToUserboolean

True when detail is curated copy that is safe to show users

errorobject

The same error fields, for clients that only read body.error

detailstringrequired

Human-readable error message

statusnumberrequired

HTTP status code

titlestringrequired

HTTP status title

metadataobject (map)

Additional error metadata

Values

object
requestIdstring

Request identifier to include when contacting support

codestring

Stable machine-readable error code, when one applies

displayToUserboolean

True when detail is curated copy that is safe to show users

403Response for status 403

application/json

detailstringrequired

Human-readable error message

statusnumberrequired

HTTP status code

titlestringrequired

HTTP status title

metadataobject (map)

Additional error metadata

Values

object
requestIdstring

Request identifier to include when contacting support

codestring

Stable machine-readable error code, when one applies

displayToUserboolean

True when detail is curated copy that is safe to show users

errorobject

The same error fields, for clients that only read body.error

detailstringrequired

Human-readable error message

statusnumberrequired

HTTP status code

titlestringrequired

HTTP status title

metadataobject (map)

Additional error metadata

Values

object
requestIdstring

Request identifier to include when contacting support

codestring

Stable machine-readable error code, when one applies

displayToUserboolean

True when detail is curated copy that is safe to show users

404Response for status 404

application/json

detailstringrequired

Human-readable error message

statusnumberrequired

HTTP status code

titlestringrequired

HTTP status title

metadataobject (map)

Additional error metadata

Values

object
requestIdstring

Request identifier to include when contacting support

codestring

Stable machine-readable error code, when one applies

displayToUserboolean

True when detail is curated copy that is safe to show users

errorobject

The same error fields, for clients that only read body.error

detailstringrequired

Human-readable error message

statusnumberrequired

HTTP status code

titlestringrequired

HTTP status title

metadataobject (map)

Additional error metadata

Values

object
requestIdstring

Request identifier to include when contacting support

codestring

Stable machine-readable error code, when one applies

displayToUserboolean

True when detail is curated copy that is safe to show users

409Response for status 409

application/json

detailstringrequired

Human-readable error message

statusnumberrequired

HTTP status code

titlestringrequired

HTTP status title

metadataobject (map)

Additional error metadata

Values

object
requestIdstring

Request identifier to include when contacting support

codestring

Stable machine-readable error code, when one applies

displayToUserboolean

True when detail is curated copy that is safe to show users

errorobject

The same error fields, for clients that only read body.error

detailstringrequired

Human-readable error message

statusnumberrequired

HTTP status code

titlestringrequired

HTTP status title

metadataobject (map)

Additional error metadata

Values

object
requestIdstring

Request identifier to include when contacting support

codestring

Stable machine-readable error code, when one applies

displayToUserboolean

True when detail is curated copy that is safe to show users

413The platform edge refused a body over its own size limit before the route ran, for example `Request Entity Too Large` followed by an error code such as `FUNCTION_PAYLOAD_TOO_LARGE`.

text/plain

The platform edge refused a body over its own size limit before the route ran, for example `Request Entity Too Large` followed by an error code such as `FUNCTION_PAYLOAD_TOO_LARGE`.

string

application/json

The platform edge refused a body over its own size limit before the route ran, and answered in JSON because the request accepts JSON, for example `{"error":{"code":"413","message":"Request Entity Too Large"}}`.

Must not include detail

errorobjectrequired
codestringrequired
messagestringrequired
451Response for status 451

application/json

detailstringrequired

Human-readable error message

statusnumberrequired

HTTP status code

titlestringrequired

HTTP status title

metadataobject (map)

Additional error metadata

Values

object
requestIdstring

Request identifier to include when contacting support

codestring

Stable machine-readable error code, when one applies

displayToUserboolean

True when detail is curated copy that is safe to show users

errorobject

The same error fields, for clients that only read body.error

detailstringrequired

Human-readable error message

statusnumberrequired

HTTP status code

titlestringrequired

HTTP status title

metadataobject (map)

Additional error metadata

Values

object
requestIdstring

Request identifier to include when contacting support

codestring

Stable machine-readable error code, when one applies

displayToUserboolean

True when detail is curated copy that is safe to show users

500Response for status 500

application/json

detailstringrequired

Human-readable error message

statusnumberrequired

HTTP status code

titlestringrequired

HTTP status title

metadataobject (map)

Additional error metadata

Values

object
requestIdstring

Request identifier to include when contacting support

codestring

Stable machine-readable error code, when one applies

displayToUserboolean

True when detail is curated copy that is safe to show users

errorobject

The same error fields, for clients that only read body.error

detailstringrequired

Human-readable error message

statusnumberrequired

HTTP status code

titlestringrequired

HTTP status title

metadataobject (map)

Additional error metadata

Values

object
requestIdstring

Request identifier to include when contacting support

codestring

Stable machine-readable error code, when one applies

displayToUserboolean

True when detail is curated copy that is safe to show users

503Response for status 503

application/json

detailstringrequired

Human-readable error message

statusnumberrequired

HTTP status code

titlestringrequired

HTTP status title

metadataobject (map)

Additional error metadata

Values

object
requestIdstring

Request identifier to include when contacting support

codestring

Stable machine-readable error code, when one applies

displayToUserboolean

True when detail is curated copy that is safe to show users

errorobject

The same error fields, for clients that only read body.error

detailstringrequired

Human-readable error message

statusnumberrequired

HTTP status code

titlestringrequired

HTTP status title

metadataobject (map)

Additional error metadata

Values

object
requestIdstring

Request identifier to include when contacting support

codestring

Stable machine-readable error code, when one applies

displayToUserboolean

True when detail is curated copy that is safe to show users