Request Validation

The Segment Public API validates all incoming requests. Be aware of two common request validation scenarios: Authentication Validation and Input Validation.

Authentication validation

You must authenticate each request with a valid API token. Requests that don't provide an authentication token, or provide an invalid or insufficient token, return authentication errors.

See the Authentication section to learn more.

Input validation

Each request validates against a set of required parameters described in the Segment Public API reference documentation for the request operation.

Requests return Validation Errors if they fail to meet the schema requirements. These errors show which parts of the request are invalid.

curl \
  --request POST \
  --url \
  --header 'Authorization: Bearer <token> ' \
  --header 'Content-Type: application/json' \
  --data '{
    "warehouse": {}

The response includes a list of errors which contains all errors that occurred during the request. In this case, both of the required warehouse.metadataId and warehouse.settings parameters are missing from the request.

HTTP/1.1 422 Unprocessable Entity

  "errors": [
      "type": "input-validation",
      "message": "\"metadataId\" is required",
      "field": "warehouse.metadataId"
      "type": "input-validation",
      "message": "\"settings\" is required",
      "field": "warehouse.settings"