POST · Inviter un membre

Produit : Inviter un membre. Paramètres, accès et exemples de réponse.

Rédigé par Red Blue

Mis à jour le

Produit

POST /api/v1/organization/invite

operationId : organization_invite

Accès

Permission

Consentements OAuth

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

organizationAutomation.invite

api:connect, organization:invite

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 ; Longueur maximale : 200

Champs du corps JSON

Nom

Emplacement

Requis

Type et contraintes

request

JSON

Oui

object

Exemple de requête

Shell
curl --request POST "$KHONY_ORIGIN/api/v1/organization/invite" \
  --header "Authorization: Bearer $KHONY_ACCESS_TOKEN" \
  --header 'Idempotency-Key: example-command' \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "request": {
    "email": "[email protected]",
    "role": "member",
    "productIds": [
      "product_01k3w8d7vhe008000000000001"
    ],
    "teamIds": []
  }
}'
Shell

Réponse de succès · HTTP 200

JSON
{
  "data": {
    "jsonFragment": "{}",
    "sha256": "0000000000000000000000000000000000000000000000000000000000000000",
    "totalBytes": 2,
    "nextFragmentCursor": null
  }
}
JSON
Schéma complet du corps JSON
JSON
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "request": {
      "type": "object",
      "properties": {
        "email": {
          "type": "string",
          "maxLength": 254,
          "format": "email",
          "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
        },
        "role": {
          "type": "string",
          "enum": [
            "admin",
            "member"
          ]
        },
        "productIds": {
          "maxItems": 100,
          "type": "array",
          "items": {
            "$ref": "#/$defs/__schema0"
          }
        },
        "teamIds": {
          "maxItems": 200,
          "type": "array",
          "items": {
            "$ref": "#/$defs/__schema1"
          }
        }
      },
      "required": [
        "email",
        "role",
        "productIds",
        "teamIds"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "request"
  ],
  "additionalProperties": false,
  "$defs": {
    "__schema0": {
      "type": "string",
      "pattern": "^product_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
    },
    "__schema1": {
      "type": "string",
      "pattern": "^support_team_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
    }
  }
}
JSON
Schéma complet de la réponse
JSON
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "jsonFragment": {
          "type": "string",
          "maxLength": 12000
        },
        "sha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "totalBytes": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "nextFragmentCursor": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "jsonFragment",
        "sha256",
        "totalBytes",
        "nextFragmentCursor"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "data"
  ],
  "additionalProperties": false
}
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": "Invite an organization member. Available only with organization management capability. Standard one-product organizations must use native Khony onboarding and administration; an OAuth scope or human confirmation does not unlock this operation. Native rights are checked again on every call. Organization actions have no product target; product actions require a real consented product. Fragmented JSON is reconstructed by concatenating jsonFragment until nextFragmentCursor is null; preserve the request for subsequent fragments. Mutations require the native human confirmation protocol and a stable Idempotency-Key. Native auth, checkout, DNS and storage operations must not be automatically retried after an uncertain result. Their effects are separate from PostgreSQL receipts. Key creation returns key material once without journaling it. Settings JSON preserves the complete native configuration and its resource reference schema."
}
JSON