POST · Annuaire

People : Annuaire. Paramètres, accès et exemples de réponse.

Rédigé par Red Blue

Mis à jour le

People

POST /api/v1/people/directory

operationId : people_directory

Accès

Permission

Consentements OAuth

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

product.read

api:connect, people:read

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

Exemple de requête

Shell
curl --request POST "$KHONY_ORIGIN/api/v1/people/directory" \
  --header "Authorization: Bearer $KHONY_ACCESS_TOKEN" \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "productId": "product_01k3w8d7vhe008000000000001",
  "request": {
    "view": "list",
    "kind": "all",
    "page": 0,
    "pageSize": 20
  }
}'
Shell

Réponse de succès · HTTP 200

JSON
{
  "data": {
    "items": [],
    "total": 0,
    "page": 0,
    "pageSize": 20,
    "nextPage": null
  }
}
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}$"
    },
    "request": {
      "type": "object",
      "properties": {
        "view": {
          "type": "string",
          "const": "list"
        },
        "kind": {
          "default": "all",
          "type": "string",
          "enum": [
            "all",
            "leads",
            "users",
            "visitors",
            "companies"
          ]
        },
        "search": {
          "default": "",
          "type": "string",
          "maxLength": 100
        },
        "page": {
          "default": 0,
          "type": "integer",
          "minimum": 0,
          "maximum": 10000
        },
        "pageSize": {
          "default": 20,
          "type": "integer",
          "minimum": 1,
          "maximum": 40
        },
        "segmentId": {
          "type": "string",
          "pattern": "^segment_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
        }
      },
      "required": [
        "view"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "productId",
    "request"
  ],
  "additionalProperties": false
}
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": {
        "items": {
          "type": "array",
          "items": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^contact_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
                  },
                  "name": {
                    "$ref": "#/$defs/__schema0"
                  },
                  "email": {
                    "$ref": "#/$defs/__schema0"
                  },
                  "externalId": {
                    "$ref": "#/$defs/__schema0"
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "lead",
                      "user",
                      "visitor"
                    ]
                  },
                  "preferredLocale": {
                    "$ref": "#/$defs/__schema0"
                  },
                  "customAttributes": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "$ref": "#/$defs/__schema1"
                    }
                  },
                  "createdAt": {
                    "$ref": "#/$defs/__schema0"
                  },
                  "updatedAt": {
                    "$ref": "#/$defs/__schema0"
                  },
                  "lastSeenAt": {
                    "$ref": "#/$defs/__schema0"
                  },
                  "lastActivityAt": {
                    "$ref": "#/$defs/__schema0"
                  },
                  "conversationCount": {
                    "type": "number"
                  },
                  "feedbackCount": {
                    "type": "number"
                  },
                  "commentCount": {
                    "type": "number"
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^person_tag_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
                        },
                        "name": {
                          "type": "string"
                        },
                        "color": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "color"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "companies": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^company_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
                        },
                        "name": {
                          "type": "string"
                        },
                        "domain": {
                          "$ref": "#/$defs/__schema0"
                        },
                        "isPrimary": {
                          "type": "boolean"
                        },
                        "role": {
                          "$ref": "#/$defs/__schema0"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "domain",
                        "isPrimary",
                        "role"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "id",
                  "name",
                  "email",
                  "externalId",
                  "kind",
                  "preferredLocale",
                  "customAttributes",
                  "createdAt",
                  "updatedAt",
                  "lastSeenAt",
                  "lastActivityAt",
                  "conversationCount",
                  "feedbackCount",
                  "commentCount",
                  "tags",
                  "companies"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^company_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
                  },
                  "name": {
                    "type": "string"
                  },
                  "domain": {
                    "$ref": "#/$defs/__schema0"
                  },
                  "externalId": {
                    "$ref": "#/$defs/__schema0"
                  },
                  "planName": {
                    "$ref": "#/$defs/__schema0"
                  },
                  "lifecycle": {
                    "$ref": "#/$defs/__schema0"
                  },
                  "countryCode": {
                    "$ref": "#/$defs/__schema0"
                  },
                  "employeeCount": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "customAttributes": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "$ref": "#/$defs/__schema2"
                    }
                  },
                  "contactCount": {
                    "type": "number"
                  },
                  "createdAt": {
                    "$ref": "#/$defs/__schema0"
                  },
                  "updatedAt": {
                    "$ref": "#/$defs/__schema0"
                  },
                  "sourceLinks": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "provider": {
                          "type": "string"
                        },
                        "externalId": {
                          "type": "string"
                        },
                        "externalUrl": {
                          "$ref": "#/$defs/__schema0"
                        },
                        "lastSyncedAt": {
                          "$ref": "#/$defs/__schema0"
                        }
                      },
                      "required": [
                        "provider",
                        "externalId",
                        "externalUrl",
                        "lastSyncedAt"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "nextSourceOffset": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "metrics": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "currency": {
                            "type": "string"
                          },
                          "mrrCents": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "arrCents": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "ltvCents": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "capturedAt": {
                            "$ref": "#/$defs/__schema0"
                          }
                        },
                        "required": [
                          "currency",
                          "mrrCents",
                          "arrCents",
                          "ltvCents",
                          "capturedAt"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "id",
                  "name",
                  "domain",
                  "externalId",
                  "planName",
                  "lifecycle",
                  "countryCode",
                  "employeeCount",
                  "customAttributes",
                  "contactCount",
                  "createdAt",
                  "updatedAt",
                  "sourceLinks",
                  "nextSourceOffset",
                  "metrics"
                ],
                "additionalProperties": false
              }
            ]
          }
        },
        "total": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "page": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "pageSize": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 9007199254740991
        },
        "nextPage": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "items",
        "total",
        "page",
        "pageSize",
        "nextPage"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "data"
  ],
  "additionalProperties": false,
  "$defs": {
    "__schema0": {
      "type": [
        "string",
        "null"
      ]
    },
    "__schema1": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "number"
        },
        {
          "type": "boolean"
        },
        {
          "type": "null"
        },
        {
          "type": "array",
          "items": {
            "$ref": "#/$defs/__schema1"
          }
        },
        {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {
            "$ref": "#/$defs/__schema1"
          }
        }
      ]
    },
    "__schema2": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "number"
        },
        {
          "type": "boolean"
        },
        {
          "type": "null"
        },
        {
          "type": "array",
          "items": {
            "$ref": "#/$defs/__schema2"
          }
        },
        {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {
            "$ref": "#/$defs/__schema2"
          }
        }
      ]
    }
  }
}
JSON

Refus et reprise

Les statuts documentés pour cette opération sont 400, 401, 402, 403, 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": "Recommended for routine directory lists. Same delegated human identity, native role and product consent as people_read; people:read and api:connect required. Results are typed contacts/companies with native fields and nextPage. This does not provide an autonomous organization-key sync contract. Concurrent changes may shift live pages."
}
JSON