How to use the strict mode via API
The strict mode is an API feature that ensures every required field is explicitly provided when creating or updating a profile. This helps avoid mistakes caused by missing or default values.
Strict mode vs. non-strict mode
Strict mode
- Requires you to specify every field that the API needs to create or update a profile
- If anything is missing, you’ll get an error message listing the exact fields you need to complete
- This is useful for users who need complete control over the data or for automation purposes, where you need all parameters explicitly defined
Non-strict mode
- Allows leaving optional fields blank: if you don’t specify them, the system automatically applies default values
- This is the default setting for most API users and keeps things simple by filling in missing details automatically
Why use strict mode?
Strict mode ensures that the data you provide is complete and accurate, which is especially useful for users working with automation or those who need strict validation for compliance. Without strict mode, missing critical fields could lead to unpredictable or unintended results.
Here's when you may need to use the strict mode:
- You need full control over all the parameters in your profile
- You want to ensure accurate validation of every field, especially for automation and compliance purposes
- You prefer clear and detailed error messages when something goes wrong
- You need backwards compatibility: don't want it anymore? Just turn it off!
How to use strict mode
To enable strict mode, add the header X-Strict-Mode: true
to your request. If you don’t specify this, the API will use the non-strict mode by default.
💡 What happens if I miss a field while using the strict mode?
The system will return a detailed error message telling you which fields are missing. This is more helpful than getting errors for each missing field separately.