Email Confirmation Resend API #
Gateway Path: /User/email/send-confirmation
Service: Authentication & Authorization
Method: POST
Auth: Bearer token in Authorization
header (see Security)
1) Overview & Purpose #
This endpoint resends a confirmation email to a user who has not yet verified their email address. It is typically used when the initial message was lost, expired, or the user requested a new confirmation link.
Important behavior: if the user’s email is already verified, the endpoint still returns 204 No Content
, but no email is sent.
2) Endpoint Definition #
HTTP: POST /User/email/send-confirmation
Headers
Authorization: Bearer <token>
— valid access token.Content-Type: application/json
Request Body Example
Fields #
- id (integer, required) — User identifier. Range: 1..2147483647 (signed 32-bit).
- email (string, required) — Email address to resend the confirmation to. Minimum length: 1. Must be a valid email.
3) Validation Rules #
- id: required, integer, must be within 1..2147483647.
- email: required, non-empty string, must follow email format.
- Body must be valid JSON; additional fields are ignored unless specified by future versions.
On validation failure, the service returns a client error (see Responses). If the email address does not meet format requirements or is blank, expect a 400 with details.
4) Responses #
4.1 Success — 204 No Content
#
- The request was accepted. If the email is not yet verified, a confirmation email is (re)sent.
- If the email is already verified, the server still returns
204
, but no email is sent.
4.2 Client/Server Errors #
- 400 Bad Request — Invalid input (e.g., malformed email, out-of-range id, invalid JSON). The error body may be one of:
- Model-state style (example):
{
"errors": {
"Email": [
"Invalid email address"
]
},
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
"title": "One or more validation errors occurred.",
"status": 400,
"traceId": "00-..."
}
- Array of error objects (example):
[
{
"errorCode": 1001,
"errorMessage": "Invalid email address"
}
]
- 401 Unauthorized — Missing/invalid Bearer token.
- 5xx Server Error — Unexpected failure (transient). Implement retry policy as appropriate.
Note: Exact error codes/messages may vary by environment. Align consumer handling with your error parser (both formats shown above are possible).
5) Idempotency & Retries #
- Multiple calls with the same payload are safe for the user state but may trigger multiple emails if the address is unverified.
- If you automate retries, consider a short backoff and optionally display a cooldown UI to prevent spam.
6) Security #
- Bearer token is mandatory:
Authorization: Bearer <token>
. - HTTPS only. Do not send tokens over insecure channels.
- Logging: Mask tokens and sensitive PII; log only high-level outcomes (e.g., “resend accepted”, “already verified”).
7) Examples #
7.1 cURL #
curl -X POST "https://api-test.10npay.com/User/email/send-confirmation" \
-H "Authorization: Bearer <YOUR_SECRET_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"id": 1234,
"email": "user.name@example.org"
}' -i
7.2 C# (.NET) #
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("https://api-test.10npay.com/User/email/send-confirmation"),
Headers = { { "Authorization", "Bearer <YOUR_SECRET_TOKEN>" } },
Content = new StringContent(
"{\"id\": 1234, \"email\": \"user.name@example.org\"}"
) { Headers = { ContentType = new MediaTypeHeaderValue("application/json") } }
};
using var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode(); // Expect 204 No Content
7.3 JavaScript (fetch) #
await fetch("https://api-test.10npay.com/User/email/send-confirmation", {
method: "POST",
headers: {
"Authorization": "Bearer <YOUR_SECRET_TOKEN>",
"Content-Type": "application/json"
},
body: JSON.stringify({ id: 1234, email: "user.name@example.org" })
}); // Expect 204 No Content
8) Sequence #
Client → API Gateway: POST /User/email/send-confirmation (Bearer, body)
API Gateway → Auth Service: Validate token
Auth Service → API Gateway: OK
API Gateway → Email/Identity Service: Resend if not verified
Email/Identity Service → API Gateway: Accepted
API Gateway → Client: 204 No Content