POST · Archiver

Workflows : Archiver. Paramètres, accès et exemples de réponse.

Rédigé par Red Blue

Mis à jour le

Workflows

POST /api/v1/workflows/archive

operationId : workflow_archive

Accès

Permission

Consentements OAuth

OAuth : délégation d’un équipier pour l’API

workflow.delete

api:connect, workflow:delete

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.

Paramètres et en-têtes

Nom

Emplacement

Requis

Type et contraintes

idempotency-key

header

Oui

string ; uuid

x-khony-confirmation

header

Non

string ; uuid

Champs du corps JSON

Nom

Emplacement

Requis

Type et contraintes

productId

JSON

Oui

string

workflowId

JSON

Oui

string

expectedRevision

JSON

Oui

string

Exemple de requête

Shell
curl --request POST "$KHONY_ORIGIN/api/v1/workflows/archive" \
  --header "Authorization: Bearer $KHONY_ACCESS_TOKEN" \
  --header 'idempotency-key: 0198f886-9f71-7000-8000-000000000010' \
  --header 'x-khony-confirmation: 0198f886-9f71-7000-8000-000000000011' \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "productId": "product_01k3w8d7vhe008000000000001",
  "workflowId": "workflow_01k3w8d7vhe008000000000001",
  "expectedRevision": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}'
Shell

Réponse de succès · HTTP 200

JSON
{
  "data": {
    "id": "workflow_01k3w8d7vhe008000000000001",
    "status": "archived",
    "revision": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
  }
}
JSON
Schéma complet du corps JSON
JSON
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "productId": {
      "type": "string",
      "pattern": "^product_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
    },
    "workflowId": {
      "type": "string",
      "pattern": "^workflow_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
    },
    "expectedRevision": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$"
    }
  },
  "required": [
    "productId",
    "workflowId",
    "expectedRevision"
  ],
  "additionalProperties": false
}
JSON
Schéma complet de la réponse
JSON
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "data": {
      "$ref": "#/$defs/__schema0"
    }
  },
  "required": [
    "data"
  ],
  "additionalProperties": false,
  "$defs": {
    "__schema0": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "number"
        },
        {
          "type": "boolean"
        },
        {
          "type": "null"
        },
        {
          "type": "array",
          "items": {
            "$ref": "#/$defs/__schema0"
          }
        },
        {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {
            "$ref": "#/$defs/__schema0"
          }
        }
      ]
    }
  }
}
JSON

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
JSON
{
  "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. Send a stable UUID Idempotency-Key with exactly the same body on retry. Effects and the immutable receipt commit together. Changed payload or stale revision returns 409. Replays reauthorize the current human. Requires verified human confirmation bound by the common runtime to this action, inputs, command key and delegated session. A model boolean is not confirmation. Requires workflow:delete consent and the native workflow.delete permission. expectedRevision comes from request.kind=workflow. Requests cancellation of active native runs and pauses its trigger subscription. The workflow:write lifecycle operation accepts only pause/resume and cannot archive."
}
JSON