Updating a Verification Session Status
After obtaining a valid client access token, you can call the /v1/session/{session_id}/status/
endpoint to update the status of a verification session.
- Base URL:
https://verification.didit.me
- Endpoint:
/v1/session/{sessionId}/update-status/
- Method:
PATCH
- Authentication:
Client Token (Bearer Token)
The Authentication
endpoint has a different Base URL
than the verification
session endpoints. Ensure you are using the correct URLs for each endpoint to
avoid connectivity issues.
Request
To update the status of a verification session programmatically, follow these steps:
Authenticate
To obtain the access_token
, refer to the Authentication documentation page.
The access_token
is valid for a limited time (x minutes), so you do not need
to authenticate for every request until the token expires.
Select Desired Parameters
- new_status: It can be
Approved
, orDeclined
. - comment (optional): A comment to be added to the review.
Update Session Status Request
PATCH /v1/session/{session_id}/update-status/ HTTP/1.1
Host: verification.didit.me
Content-Type: application/json
Authorization: Bearer {access_token}
{
"new_status": "Declined",
"comment": "Duplicated user"
}
Response
Returns session details including session_id
, session_token
, url
. The session_id
should be linked to your user in your User model, and you should open or send the url
for your user to start the verification process.
Example Response
{
"session_id": "your-session-id",
}
Code Example:
const updateSessionStatus = async (
sessionId: string,
new_status: string,
comment: string,
) => {
const url = `${BASE_URL}/v1/session/${sessionId}/update-status/`;
const token = await getClientToken();
if (!token) {
console.error('Error fetching client token');
} else {
const body = {
new_status: new_status,
comment: comment,
};
const requestOptions = {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${token.access_token}`,
},
body: JSON.stringify(body),
};
try {
const response = await fetch(url, requestOptions);
const data = await response.json();
if (response.status === 200 && data) {
return data;
} else {
console.error('Error updating session status:', data.message);
throw new Error(data.message);
}
} catch (error) {
console.error('Network error:', error);
throw error;
}
}
};