> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.withpersona.com/2020-05-18/resuming-inquiries/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.withpersona.com/_mcp/server. # Resuming Inquiries > Resume an Inquiry securely with a session token or one-time link. Inquiries may need to be resumed in several situations: 1. **The Inquiry is in progress and the user does not have a session token.** As Inquiries contain PII, we restrict when Inquiries can be resumed. While newly created Inquiries can be accessed by anyone with a link to the Inquiry, pending Inquiries require a session token to be accessed by the end user. Session tokens are generated by resuming Inquiries, and can be passed via query string parameters for hosted flows, and via the client SDKs for embedded, inline, and native flows. 2. **The user lost their session token.** [Session tokens](/inquiry-sessions#session-tokens) are stored in [session storage](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage), which is local to the current browser tab. If a user closes a pending Inquiry and reopens it in a separate browser window, they will lose their session token and see a 'Session expired' error. They will be unable to continue the Inquiry without a new session token or [one-time link](/inquiry-one-time-links). 3. **The Inquiry has expired.** To ensure that Inquiries are associated with only one individual, pending Inquiries are expired after a set time period (24 hours by default), after which the Inquiry becomes inaccessible to end users. For more information, see [Inquiry Expiration](/inquiry-expiration). 4. **The Inquiry session has expired.** This is less common, but if an Inquiry has multiple sessions, older sessions may expire before the Inquiry expires. Persona provides two ways to access Inquiries that are in progress: 1. Generating a [one-time link](/inquiry-one-time-links) 2. Creating a new [session token](/inquiry-sessions#session-tokens) > **Info** > > #### One-time link codes vs. session tokens > > While pending Inquiries can also be accessed by including a [session token](/inquiry-sessions#session-tokens) in the Inquiry link URL, one-time links present the following benefits: > > 1. Security: one-time link codes expire after a single use (with a 5 minute grace period), whereas session tokens are valid for the lifetime of the [Inquiry Session](/inquiry-sessions). > 2. Convenience: session tokens are JWTs and can result in verbose links, while one-time links are short and portable. This can be useful when presenting one-time links as QR codes. > > One-time links have the following downsides: > > 1. Browser-only: as one-time links are URLs, they can only be used for browser-based flows ([Hosted Flow Integration](/hosted-flow), and cannot be used in Inquiry SDKs ([Embedded Integration](/embedded-flow) and [Mobile Integration](/mobile-sdks)). > 2. Expired Inquiries: one-time links cannot be generated for expired Inquiries. Expired Inquiries must first be resumed. ## Generating a one-time link If you are using a browser-based integration, you can generate a one-time link that will allow the end user to access the Inquiry. Call [/api/v1/inquiries/\/generate-one-time-link](/api-reference/inquiries/generate-a-one-time-link) to receive a one-time link. Within the response, the one-time link can be found within the response's `meta` object. This link will expire after a set time period (24 hours by default) if not used. **`ruby`** ```ruby ruby require 'http' response = HTTP. headers('Authorization': "Bearer #{api_key}"). post("https://api.withpersona.com/api/v1/inquiries/#{inquiry_id}/generate-one-time-link") inquiry = JSON.parse(response.body) ``` **`python`** ```python python import requests response = requests.post( 'https://withpersona.com/api/v1/inquiries/{}/generate-one-time-link'.format(inquiry_id), headers: { 'Authorization': 'Bearer {}'.format(api_key) }, ) inquiry = response.json() ``` **`javascript`** ```javascript javascript const request = require("request"); request.post( { json: true, url: 'https://withpersona.com/api/v1/inquiries/' + inquiryId + '/generate-one-time-link', headers: { Authorization: 'Bearer ' + apiKey } }, (err, res, body) => { inquiry = res; } ); ``` Then, send the one-time link to the end user. ## Creating a new session token If the Inquiry is expired, or if you use a non-browser-based integration, you will need to create a new session token and use that to access the Inquiry. ### Step 1: Create a session token Call [/api/v1/inquiries/\/resume](/api-reference/inquiries/resume-an-inquiry) to receive a session token. Within the response, the session token can be found as `session-token` within the response's `meta` object. This token will expire after a set time period (24 hours by default) if it is not used. **`ruby`** ```ruby ruby require 'http' response = HTTP. headers('Authorization': "Bearer #{api_key}"). post("https://api.withpersona.com/api/v1/inquiries/#{inquiry_id}/resume") inquiry = JSON.parse(response.body) ``` **`python`** ```python python import requests response = requests.post( 'https://withpersona.com/api/v1/inquiries/{}/resume'.format(inquiry_id), headers: { 'Authorization': 'Bearer {}'.format(api_key) }, ) inquiry = response.json() ``` **`javascript`** ```javascript javascript const request = require("request"); request.post( { json: true, url: 'https://withpersona.com/api/v1/inquiries/' + inquiryId + '/resume', headers: { Authorization: 'Bearer ' + apiKey } }, (err, res, body) => { inquiry = res; } ); ``` **`json`** ```json json { "data": { ... }, "meta": { "session-token": "SESSION_TOKEN" } } ``` ### Step 2: Load the session Boot up the flow using both the Inquiry ID and session token as parameters. #### [Embedded flow](/embedded-flow) Add the `inquiryId` and the `sessionToken` as an input to the builder: **`html`** ```html html ``` #### [Hosted flow](/hosted-flow) Append the `inquiry-id` and `session-token` parameters to the end of the hosted flow URL: `&inquiry-id=&session-token=` ## Resuming Inquiries vs. creating new Inquiries When possible, we recommend resuming pending Inquiries rather than creating a brand new Inquiry when handling returning users. If your user has already completed part of the Inquiry, resuming the Inquiry will allow them to pick up where they left off, which improves the user experience and reduces data duplication. Note that resuming Inquiries on older versions of a template can lead to unexpected results. Inquiries are pinned to the current state of their template when created, and any updates made to the template between when the Inquiry was created and when it was resumed will not be reflected in the resumed Inquiry. If the latest published version of the Inquiry's template has changed, we recommend creating a new Inquiry instead of resuming the pending Inquiry, to ensure that the most up-to-date configuration is used. To check if an Inquiry is on the latest template version, examine the `inquiry-template` object within the `included` array in the Inquiry API response. The `inquiry-template` object in the response will contain the ID of the latest published template version under the field `latest-published-version.id`. If this ID differs from the `inquiry-template-version-id` on the Inquiry, then the Inquiry is not on the latest template version. For additional guidance, learn more at our [Help Center](https://help.withpersona.com/articles/7xYuQOCfXXjW4cgS3c7EOg/) > Resume an Inquiry securely with a session token or one-time link.