> Toden documentation. For the full index fetch /llms.txt. Every page is available as Markdown by appending .md to its URL. Identity verification uses /api/kyc, Risk Intelligence uses /api/v1; they are separate contracts with different error shapes. Never invent an endpoint, field or enum value: read the API reference page for the operation first.

# Uncancel a session or verification

POST https://sandbox-api.toden.co/api/kyc/sessions/{sessionId}/uncancel
Content-Type: application/json

Reverses a cancel. An unsubmitted session reopens with its saved progress, and a verification returns to processing.

**Error codes**

| `error` | Status | Meaning |
|---|---|---|
| `invalid_input` | 400 | The reason is too long, or the body carries an unknown field. |
| `not_found` | 404 | No session or verification with that id for this organisation and environment. |
| `not_cancelled` | 409 | The session or verification is not cancelled. |
| `session_expired` | 409 | The session ran out of time while cancelled. Create a new session. |
| `Missing or invalid Authorization header` | 401 | No bearer credential was sent. |
| `Invalid API key` | 401 | The key is unknown or revoked. |
| `environment_mismatch` | 403 | The key belongs to an environment this host does not serve. |
| `origin_not_allowed` | 403 | The request origin is not on the publishable key allowlist. |
| `ip_not_allowed` | 403 | The caller address is not on the secret key allowlist. |
| `organization_suspended` | 403 | The organisation is suspended. |
| `secret_key_required` | 403 | A publishable key was used on a secret-key endpoint. |

Requires a secret (`sk_`) key. A publishable key receives `403 secret_key_required`.

Reference: https://docs.toden.co/api-reference/verification/sessions/uncancel-session

## Authentication

- `Authorization` header (bearer token, required) — Send the API key as a Bearer token. Each operation states whether a publishable key is enough or a secret key is required.

## Servers

- `https://sandbox-api.toden.co` (Sandbox, default)
- `https://api.toden.co` (Production)

## Request

### Path parameters

- `sessionId` (string, required) — The session identifier. For cancel and uncancel, a verification identifier works too.

### Body (application/json)

This endpoint expects a CancelSessionRequest.

- `reason` (string, optional) — Why. Kept internally and never sent to webhooks.

## Response

### 200

The session or verification after the uncancel.

- `id` (string, required) — The session or verification identifier.
- `kind` (enum, required) — `attempt` for a session not yet submitted, `verification` for a submitted one.
  - Allowed values: `attempt`, `verification`
- `status` (enum, required) — The top-line status now.
  - Allowed values: `not_started`, `in_progress`, `processing`, `in_review`, `awaiting_resubmission`, `approved`, `declined`, `abandoned`, `expired`, `error`, `cancelled`
- `previousStatus` (string, required, nullable) — The top-line status before the change, from the same vocabulary as `status`.
- `changed` (boolean, required) — False when the call changed nothing, for example a repeat of an earlier cancel.
- `refunded` (boolean, required) — Whether a reserved charge was released. A verification whose checks had begun is not refunded.

## Errors

### 400 Bad Request Error

The request body, query or path was invalid.

- `error` (string, required) — A stable machine-readable code such as `invalid_input`. Authentication failures (401) carry a short sentence here instead of a code.
- `message` (string, optional) — A human-readable explanation, safe to log. The wording may change.

### 401 Unauthorized Error

The Authorization header is missing, or the API key is unknown or revoked.

- `error` (string, required) — A stable machine-readable code such as `invalid_input`. Authentication failures (401) carry a short sentence here instead of a code.
- `message` (string, optional) — A human-readable explanation, safe to log. The wording may change.

### 403 Forbidden Error

The key may not call this endpoint, or the organisation may not use this feature.

- `error` (string, required) — A stable machine-readable code such as `invalid_input`. Authentication failures (401) carry a short sentence here instead of a code.
- `message` (string, optional) — A human-readable explanation, safe to log. The wording may change.

### 404 Not Found Error

The resource does not exist for this organisation and environment.

- `error` (string, required) — A stable machine-readable code such as `invalid_input`. Authentication failures (401) carry a short sentence here instead of a code.
- `message` (string, optional) — A human-readable explanation, safe to log. The wording may change.

### 409 Conflict Error

The request conflicts with the current state of the resource.

- `error` (string, required) — A stable machine-readable code such as `invalid_input`. Authentication failures (401) carry a short sentence here instead of a code.
- `message` (string, optional) — A human-readable explanation, safe to log. The wording may change.

## Examples

**Request**

```json
{
  "reason": "The applicant asked to stop"
}
```

**Response**

```json
{
  "id": "ses_01j9x2k4m8",
  "kind": "attempt",
  "status": "in_progress",
  "previousStatus": "cancelled",
  "changed": true,
  "refunded": false
}
```

**SDK Code**

```python
import requests

url = "https://sandbox-api.toden.co/api/kyc/sessions/sessionId/uncancel"

payload = { "reason": "The applicant asked to stop" }
headers = {
    "Authorization": "Bearer <apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://sandbox-api.toden.co/api/kyc/sessions/sessionId/uncancel';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <apiKey>', 'Content-Type': 'application/json'},
  body: '{"reason":"The applicant asked to stop"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://sandbox-api.toden.co/api/kyc/sessions/sessionId/uncancel"

	payload := strings.NewReader("{\n  \"reason\": \"The applicant asked to stop\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://sandbox-api.toden.co/api/kyc/sessions/sessionId/uncancel")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"reason\": \"The applicant asked to stop\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://sandbox-api.toden.co/api/kyc/sessions/sessionId/uncancel")
  .header("Authorization", "Bearer <apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"reason\": \"The applicant asked to stop\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://sandbox-api.toden.co/api/kyc/sessions/sessionId/uncancel', [
  'body' => '{
  "reason": "The applicant asked to stop"
}',
  'headers' => [
    'Authorization' => 'Bearer <apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://sandbox-api.toden.co/api/kyc/sessions/sessionId/uncancel");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"reason\": \"The applicant asked to stop\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["reason": "The applicant asked to stop"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://sandbox-api.toden.co/api/kyc/sessions/sessionId/uncancel")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```