POST /v1/verify/{app_id}/verifications/intent
Create an email verification request with intent
Overview
This endpoint creates an email verification request for a user with a specific intent. It's designed for integration with Thread and other services that need to verify user email addresses.
Authentication
To authenticate with this endpoint, you need to create an M2M (Machine-to-Machine) token from the Scute dashboard and include it in the X-Authorization
header.
Request
Method
POST
URL
/v1/verify/\{app_id\}/verifications/intent
Path Parameters
Parameter | Type | Required | Description |
---|---|---|---|
app_id | string | Yes | The ID of the app |
Request Body
{
"intent_name": "string",
"meta_data": {
"contact_email": "string"
}
}
Body Parameters
Parameter | Type | Required | Description |
---|---|---|---|
intent_name | string | Yes | Name/identifier for the verification intent |
meta_data | object | Yes | Metadata containing user information |
meta_data.contact_email | string | Yes | Email address to verify |
Response
Success Response (200 OK)
{
"verification_id": "uuid-string"
}
Error Responses
400 Bad Request - Missing Meta Data
{
"error": "Meta data is required",
"error_code": "meta_data_required"
}
400 Bad Request - Missing Email
{
"error": "Email is required",
"error_code": "email_required"
}
400 Bad Request - Missing Intent Name
{
"error": "Intent name is required",
"error_code": "intent_name_required"
}
400 Bad Request - Invalid Email
{
"error": "Invalid email format",
"error_code": "invalid_email"
}
Example Usage
cURL
curl -X POST "https://api.scute.io/v1/verify/c24ee9a6-31a6-4be8-b21e-1796c6a91273/verifications/intent" \
-H "Content-Type: application/json" \
-H "X-Authorization: your_access_token" \
-d '{
"intent_name": "user_signup_verification",
"meta_data": {
"contact_email": "user@example.com"
}
}'
JavaScript
const response = await fetch('/v1/verify/c24ee9a6-31a6-4be8-b21e-1796c6a91273/verifications/intent', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Authorization': 'your_access_token'
},
body: JSON.stringify({
intent_name: 'user_signup_verification',
meta_data: {
contact_email: 'user@example.com'
}
})
});
const data = await response.json();
console.log(data.verification_id);
Behavior
- Email Validation: The endpoint validates the email format using
sanitize_email()
andis_valid_email()
- User Creation: If the user doesn't exist, it creates a new app user with the provided email
- Verification Creation: Creates an email verification request with a unique reason (intent_name + random hex)
- Event Recording: Records a "verification.email.requested" event for tracking
- Response: Returns the verification ID for tracking purposes
Notes
- The endpoint automatically finds or creates an app user based on the email
- The verification reason is generated by combining
intent_name
with a random hex string for uniqueness - Email addresses are automatically sanitized (lowercased and trimmed)
- An event is recorded for analytics/tracking purposes
Related Endpoints
GET /v1/verify/\{app_id\}/verifications/\{id\}
- Get verification detailsPOST /v1/verify/\{app_id\}/verifications/verify
- Verify the email verification code