POST · Consulter
Rédigé par Red Blue
Mis à jour le
POST /api/v1/workflows/read
operationId : workflow_read
Accès | Permission | Consentements OAuth |
|---|---|---|
OAuth : délégation d’un équipier pour l’API | workflow.read | api:connect, workflow:inspect |
KHONY_ORIGIN est l’origine HTTPS de votre application Khony, sans chemin final. Remplacez les identifiants de l’exemple par ceux de vos ressources autorisées. Les données de réponse ci-dessous illustrent le format ; elles ne sont pas le résultat d’un appel à votre organisation.
Champs du corps JSON
Nom | Emplacement | Requis | Type et contraintes |
|---|---|---|---|
productId | JSON | Oui | string |
request | JSON | Oui | object |
fragmentCursor | JSON | Non | string ; Longueur maximale : 2048 |
Variantes de la requête
Sélecteur | Valeur | Autres champs requis dans request |
|---|---|---|
request.kind | "workflows" | Aucun autre champ imposé |
request.kind | "drafts" | Aucun autre champ imposé |
request.kind | "draft" | draftId |
request.kind | "workflow" | workflowId |
request.kind | "versions" | workflowId |
request.kind | "version" | workflowId, versionId |
request.kind | "subscriptions" | workflowId |
request.kind | "runs" | Aucun autre champ imposé |
request.kind | "run" | runId |
request.kind | "catalog" | Aucun autre champ imposé |
request.kind | "templates" | Aucun autre champ imposé |
request.kind | "resources" | resource |
request.kind | "contact_fields" | Aucun autre champ imposé |
request.kind | "ticket_options" | Aucun autre champ imposé |
request.kind | "ticket_form" | typeId |
Choisissez une variante et respectez son schéma complet : les contraintes des champs optionnels et les unions imbriquées restent applicables.
Exemple de requête
curl --request POST "$KHONY_ORIGIN/api/v1/workflows/read" \
--header "Authorization: Bearer $KHONY_ACCESS_TOKEN" \
--header 'Content-Type: application/json' \
--data-raw '{
"productId": "product_01k3w8d7vhe008000000000001",
"request": {
"kind": "draft",
"draftId": "workflow_draft_01k3w8d7vhe008000000000001"
}
}'Réponse de succès · HTTP 200
{
"kind": "draft",
"jsonFragment": "{\"id\":\"workflow_draft_01k3w8d7vhe008000000000001\",\"name\":\"Follow up\",\"templateId\":null,\"revision\":0,\"workflowId\":null,\"status\":\"draft\",\"currentVersion\":0,\"document\":{\"schemaVersion\":1,\"trigger\":{\"id\":\"trigger\",\"event\":\"feedback-created\",\"version\":1,\"config\":{\"channels\":[\"widget\"],\"audience\":\"everyone\",\"hours\":\"always\",\"extra\":{}}},\"blocks\":[{\"id\":\"wait-block\",\"label\":\"Follow up\",\"steps\":[{\"id\":\"wait-step\",\"kind\":\"wait\",\"version\":1,\"config\":{\"until\":\"1h\",\"interrupt\":false}}]}],\"edges\":[{\"id\":\"next\",\"source\":\"trigger\",\"port\":\"next\",\"target\":\"wait-block\"}]},\"editor\":{\"nodes\":{\"trigger\":{\"x\":0,\"y\":0},\"wait-block\":{\"x\":300,\"y\":0}}},\"labels\":{\"teams\":[],\"policies\":[]},\"updatedAt\":\"2026-10-23T10:00:00.000Z\"}",
"sha256": "f9edb0484f4962f25181b9e74a659668420b6e7ec9451e804edf787bee86d6f6",
"totalBytes": 710,
"nextFragmentCursor": null
}Schéma complet du corps JSON
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"productId": {
"type": "string",
"pattern": "^product_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
},
"request": {
"oneOf": [
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "workflows"
},
"limit": {
"$ref": "#/$defs/__schema0"
},
"cursor": {
"$ref": "#/$defs/__schema1"
}
},
"required": [
"kind"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "drafts"
},
"limit": {
"$ref": "#/$defs/__schema0"
},
"cursor": {
"$ref": "#/$defs/__schema1"
}
},
"required": [
"kind"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "draft"
},
"draftId": {
"type": "string",
"pattern": "^workflow_draft_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
}
},
"required": [
"kind",
"draftId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "workflow"
},
"workflowId": {
"type": "string",
"pattern": "^workflow_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
}
},
"required": [
"kind",
"workflowId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "versions"
},
"workflowId": {
"type": "string",
"pattern": "^workflow_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
},
"limit": {
"$ref": "#/$defs/__schema0"
},
"cursor": {
"$ref": "#/$defs/__schema1"
}
},
"required": [
"kind",
"workflowId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "version"
},
"workflowId": {
"type": "string",
"pattern": "^workflow_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
},
"versionId": {
"type": "string",
"pattern": "^workflow_version_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
}
},
"required": [
"kind",
"workflowId",
"versionId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "subscriptions"
},
"workflowId": {
"type": "string",
"pattern": "^workflow_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
}
},
"required": [
"kind",
"workflowId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "runs"
},
"workflowId": {
"type": "string",
"pattern": "^workflow_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
},
"status": {
"type": "string",
"enum": [
"queued",
"running",
"waiting",
"completed",
"failed",
"cancelled"
]
},
"limit": {
"$ref": "#/$defs/__schema0"
},
"cursor": {
"$ref": "#/$defs/__schema1"
}
},
"required": [
"kind"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "run"
},
"runId": {
"type": "string",
"pattern": "^workflow_run_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
}
},
"required": [
"kind",
"runId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "catalog"
}
},
"required": [
"kind"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "templates"
}
},
"required": [
"kind"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "resources"
},
"resource": {
"type": "string",
"enum": [
"teams",
"policies",
"connections",
"slackConnections",
"conversationTags",
"contactTags",
"recipients",
"ideas",
"boards"
]
},
"search": {
"type": "string",
"maxLength": 200
},
"offset": {
"default": 0,
"type": "integer",
"minimum": 0,
"maximum": 100000
},
"selectedId": {
"type": "string",
"format": "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)$"
}
},
"required": [
"kind",
"resource"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "contact_fields"
}
},
"required": [
"kind"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "ticket_options"
}
},
"required": [
"kind"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "ticket_form"
},
"typeId": {
"type": "string",
"pattern": "^ticket_type_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
}
},
"required": [
"kind",
"typeId"
],
"additionalProperties": false
}
]
},
"fragmentCursor": {
"type": "string",
"maxLength": 2048
}
},
"required": [
"productId",
"request"
],
"additionalProperties": false,
"$defs": {
"__schema0": {
"default": 20,
"type": "integer",
"minimum": 1,
"maximum": 50
},
"__schema1": {
"type": "string",
"minLength": 1,
"maxLength": 2048
}
}
}Schéma complet de la réponse
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"kind": {
"type": "string",
"enum": [
"workflows",
"drafts",
"draft",
"workflow",
"versions",
"version",
"subscriptions",
"runs",
"run",
"catalog",
"templates",
"resources",
"contact_fields",
"ticket_options",
"ticket_form"
]
},
"jsonFragment": {
"type": "string",
"maxLength": 24576
},
"sha256": {
"type": "string",
"pattern": "^[a-f0-9]{64}$"
},
"totalBytes": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"nextFragmentCursor": {
"anyOf": [
{
"type": "string",
"maxLength": 2048
},
{
"type": "null"
}
]
}
},
"required": [
"kind",
"jsonFragment",
"sha256",
"totalBytes",
"nextFragmentCursor"
],
"additionalProperties": false
}Refus et reprise
Les statuts documentés pour cette opération sont 400, 401, 402, 403, 404, 409, 428, 429, 500, 503. Identifiez la cause avec error.code et, lorsqu’il est présent, error.reason. Une réponse 409 peut demander une relecture de révision ou signaler une commande incompatible ; une réponse 428 demande une confirmation humaine. Ne rejouez une écriture que selon son contrat.
Notes du contrat
{
"description": "Requires a dedicated API OAuth bearer for audience /api/v1, api:connect and the stated workflow scope, current organization/product consent and native human permissions. Organization keys and cookies are not accepted. Every admission consumes a product API request; native write billing checks apply. Requires explicit workflow:inspect consent; the historical workflow:read scope covers workflow_list summaries only. Select request.kind. Response contains an exact JSON fragment; concatenate fragments in order until nextFragmentCursor=null, then parse once. Keep request unchanged while sending fragmentCursor. sha256 binds all fragments to the same serialized content; a content or actor change returns 409. Native collection pagination is inside the reconstructed JSON. Read revisions from workflow/run/approval detail before commands. Version definitions and Explorer documents preserve native schema and resource references. Run output excludes private runtime context and provider payloads."
}