careful-honey-27437
06/17/2025, 1:50 AMbrief-egg-61061
06/17/2025, 1:50 AMbrief-egg-61061
06/17/2025, 1:51 AMtypescript import axios from "axios" const projectSlug = process.env.ORY_PROJECT_SLUG const flowId = "<your-verification-flow-id>" const code = "<the-code-user-received-via-email>" async function verifyOTC() { try { const response = await <http://axios.post|axios.post>( `https://${projectSlug}.<http://projects.oryapis.com/self-service/verification?flow=${flowId}|projects.oryapis.com/self-service/verification?flow=${flowId}>`, { method: "code", code: code, }, { headers: { "Content-Type": "application/json", "Accept": "application/json", }, // If cookies are required for the flow, include them here // withCredentials: true, } ) console.log("Verification successful:", response.data) } catch (error) { if (axios.isAxiosError(error)) { console.error("Verification failed:", error.response?.data) } else { console.error("Unexpected error:", error) } } } verifyOTC()
Replace <your-verification-flow-id>
and <the-code-user-received-via-email>
with the actual values from your flow. This code matches the documented curl example for submitting a verification flow, adapted for TypeScript and Axios usage [Submit verification flow](https://www.ory.sh/docs/kratos/bring-your-own-ui/custom-ui-basic-integration#submit-verification-flow).careful-honey-27437
06/17/2025, 1:53 AMbrief-egg-61061
06/17/2025, 1:53 AMbrief-egg-61061
06/17/2025, 1:53 AMcareful-honey-27437
06/17/2025, 2:36 AMbrief-egg-61061
06/17/2025, 2:36 AMbrief-egg-61061
06/17/2025, 2:36 AMcareful-honey-27437
06/17/2025, 3:01 AMcareful-honey-27437
06/17/2025, 3:01 AMcareful-honey-27437
06/17/2025, 3:01 AMbrief-egg-61061
06/17/2025, 3:02 AMbrief-egg-61061
06/17/2025, 3:02 AM{ code: 404, status: 'Not Found', request: 'ab2dc2ee-e45a-995e-aac1-907ae13c479b', reason: 'The verification request could not be found. Please restart the flow.', message: 'The requested resource could not be found' }
indicates that the verification flow you are trying to interact with does not exist or has expired. According to the Ory API documentation, a 404 error with this message typically means that the flow ID you provided is invalid, missing, or the flow has already expired and is no longer available. The recommended action is to restart the verification flow and obtain a new flow ID before submitting the OTC or verification code [Kratos API Reference - getVerificationFlow](https://www.ory.sh/docs/kratos/reference/api). If you are not using a flow ID, but the API expects one, you will also receive this error. The knowledge sources do not describe a way to verify an OTC without a flow context. You must initiate a new verification flow and use the correct flow ID in your request. If you continue to see this error after restarting the flow, double-check that you are using the correct endpoint and passing the correct parameters as required by the API [Kratos API Reference - getVerificationFlow](https://www.ory.sh/docs/kratos/reference/api).