> This page is part of EVVA for Developers (https://developers.evvahub.com), the documentation of the EVVA Partner API. The API is in developer preview and the SDK packages are not yet published: do not suggest installing them. Index: https://developers.evvahub.com/llms.txt

# Request a handoff to a person

POST https://api.evvahub.com/partner/v1/accounts/{creatorId}/conversations/{conversationId}/handoff
Content-Type: application/json

Hands the conversation from your application to a person, releasing your lease and holding automation off until a person hands it back.

**What happens**

- Applications hand to a person only: `to` is `HUMAN`, the default. `to: APPLICATION` is refused with `403 HANDOFF_NOT_PERMITTED`.
- Your application's lease is released. A `fencingToken` is optional; if you send one, it must be current.
- Automation stays off in the conversation, for applications and the creator's own automations, until a person hands the conversation back.
- EVVA records `handoff.requested`. The first person to act in the conversation completes the handoff (`handoff.completed`).
- Asking again while the conversation already waits for a person changes nothing and records no second event.
- `reason` is a machine code; no free text is accepted.

See [conversation leases](/conversation-leases).

**When a person hands the conversation to your application**

A person on the agency's team can hand the conversation to your application. That ends the hold and any reply pause. The conversation is then reserved for your application until it acquires the lease or sends a message (`handoff.completed`).

**Errors**

- `403 HANDOFF_NOT_PERMITTED` — `to` is `APPLICATION`.
- `409 LEASE_HELD` — someone else holds a live lease, or a person reserved the conversation for another application. `Retry-After` is set when known.
- `409 STALE_FENCING_TOKEN` — the `fencingToken` you sent is not the current one.

**Required scopes:** `write:messages`.

Reference: https://developers.evvahub.com/api-reference/conversation-leases/handoff-conversation

## Authentication

- `Authorization` header (bearer token, required) — OAuth 2.0 client credentials. Request an access token at `POST /partner/v1/oauth/token` (`grant_type=client_credentials`) with the application's client secret or a `private_key_jwt` assertion, then send it as `Authorization: Bearer evpa_live_…` (or `evpa_test_…` for a sandbox application). Tokens are opaque and short lived (see `expires_in`); there is no refresh token. Each operation lists the scopes it requires.

## Request

### Path parameters

- `creatorId` (string, required) — The creator profile id — the ONLY source of the creator a request acts for.
- `conversationId` (string, required)

### Headers

- `X-Creator-Id` (string, optional) — Optional echo of the path `creatorId`; any other value is refused with 403 CREATOR_CONTEXT_MISMATCH.

### Body (application/json)

This endpoint expects a HandoffRequest.

- `to` (enum, optional) — Who the conversation is handed to. Your application hands it to `HUMAN`, the default. `APPLICATION` is refused with `403 HANDOFF_NOT_PERMITTED`.
  - Allowed values: `HUMAN`, `APPLICATION`
- `fencingToken` (HandoffRequestFencingToken, optional) — When `to` is `HUMAN`: the application's current lease token, if it holds one.
- `reason` (string, optional) — A machine code such as `buyer_requested_human`, never prose.

## Response

### 200

Handed off.

- `conversationId` (string, required)
- `status` (enum, required)
  - Allowed values: `HANDED_TO_HUMAN`, `HANDED_TO_APPLICATION`
- `to` (enum, required)
  - Allowed values: `HUMAN`, `APPLICATION`
- `applicationId` (string, required, nullable)

## Errors

### 400 Bad Request Error

Invalid or missing parameters: `INVALID_REQUEST` (`details` names the fields), or a more specific code of the operation.

- `code` (string, required) — A stable machine-readable code (see `KnownErrorCode`; new codes may appear within v1).
- `error` (string, required)
- `requestId` (string, required, nullable) — The same value as the `X-Request-Id` response header — quote it when reporting a problem.
- `details` (any, optional) — Extra detail for the code, specific to the operation, such as field errors, limits or the creator's account-status details.

### 401 Unauthorized Error

Token missing, malformed, expired or revoked: `INVALID_TOKEN` (or `UNAUTHORIZED` when no bearer token was sent). Request a new token and retry.

- `code` (string, required) — A stable machine-readable code (see `KnownErrorCode`; new codes may appear within v1).
- `error` (string, required)
- `requestId` (string, required, nullable) — The same value as the `X-Request-Id` response header — quote it when reporting a problem.
- `details` (any, optional) — Extra detail for the code, specific to the operation, such as field errors, limits or the creator's account-status details.

### 403 Forbidden Error

`HANDOFF_NOT_PERMITTED` — an application tried to hand the conversation to an application; only a person can do that. Or one of the creator-access refusals.

- `code` (string, required) — A stable machine-readable code (see `KnownErrorCode`; new codes may appear within v1).
- `error` (string, required)
- `requestId` (string, required, nullable) — The same value as the `X-Request-Id` response header — quote it when reporting a problem.
- `details` (any, optional) — Extra detail for the code, specific to the operation, such as field errors, limits or the creator's account-status details.

### 404 Not Found Error

No such resource, or it belongs to another creator: `NOT_FOUND` or a more specific code.

- `code` (string, required) — A stable machine-readable code (see `KnownErrorCode`; new codes may appear within v1).
- `error` (string, required)
- `requestId` (string, required, nullable) — The same value as the `X-Request-Id` response header — quote it when reporting a problem.
- `details` (any, optional) — Extra detail for the code, specific to the operation, such as field errors, limits or the creator's account-status details.

### 409 Conflict Error

`LEASE_HELD` (Retry-After when known), `STALE_FENCING_TOKEN`.

- `code` (string, required) — A stable machine-readable code (see `KnownErrorCode`; new codes may appear within v1).
- `error` (string, required)
- `requestId` (string, required, nullable) — The same value as the `X-Request-Id` response header — quote it when reporting a problem.
- `details` (any, optional) — Extra detail for the code, specific to the operation, such as field errors, limits or the creator's account-status details.

### 429 Too Many Requests Error

Rate limited: `RATE_LIMIT_EXCEEDED`. Wait `Retry-After` seconds before retrying.

- `code` (enum, required) — A stable machine-readable code (see `KnownErrorCode`; new codes may appear within v1).
  - Allowed values: `RATE_LIMIT_EXCEEDED`, `TOO_MANY_MESSAGES`
- `error` (string, required)
- `requestId` (string, required, nullable) — The same value as the `X-Request-Id` response header — quote it when reporting a problem.
- `details` (RateLimitErrorDetails, optional) — Extra detail for the code, specific to the operation, such as field errors, limits or the creator's account-status details.

### 500 Internal Server Error

Unexpected server error: `INTERNAL_ERROR`. Nothing internal is disclosed; quote the `X-Request-Id` when you report it.

- `code` (string, required) — A stable machine-readable code (see `KnownErrorCode`; new codes may appear within v1).
- `error` (string, required)
- `requestId` (string, required, nullable) — The same value as the `X-Request-Id` response header — quote it when reporting a problem.
- `details` (any, optional) — Extra detail for the code, specific to the operation, such as field errors, limits or the creator's account-status details.

### 503 Service Unavailable Error

Temporarily unavailable: `SERVICE_UNAVAILABLE`, `TEMPORARILY_UNAVAILABLE`, `MEDIA_STORAGE_UNAVAILABLE` or `CREATOR_STANDING_UNAVAILABLE`. Retry after `Retry-After` seconds.

- `code` (string, required) — A stable machine-readable code (see `KnownErrorCode`; new codes may appear within v1).
- `error` (string, required)
- `requestId` (string, required, nullable) — The same value as the `X-Request-Id` response header — quote it when reporting a problem.
- `details` (any, optional) — Extra detail for the code, specific to the operation, such as field errors, limits or the creator's account-status details.

## Types

### HandoffRequestFencingToken

When `to` is `HUMAN`: the application's current lease token, if it holds one.

- string
- integer

### RateLimitErrorDetails

Extra detail for the code, specific to the operation, such as field errors, limits or the creator's account-status details.

- `retryAfterSec` (integer, required)
- `level` (enum, optional) — The DM send limit that refused the message, set only with `TOO_MANY_MESSAGES`. It is never a quota, a count or a key. - `conversation` — one side of one thread. - `sender` — a person's own ceiling; it does not apply to applications. - `creator` — everything sent for the creator, studio included. - `application` — everything your application sends. - `agency` — everything your agency sends. - `platform` — the agency's fair share of the platform: its throughput or its concurrency. See [rate limits](/authentication/rate-limits).
  - Allowed values: `conversation`, `sender`, `creator`, `application`, `agency`, `platform`

## Examples

**Request**

```json
{
  "to": "HUMAN",
  "fencingToken": "42",
  "reason": "buyer_asked_for_creator"
}
```

**Response**

```json
{
  "conversationId": "cm4r8a1vz0007qz8wk2j9h4mt",
  "status": "HANDED_TO_HUMAN",
  "to": "HUMAN",
  "applicationId": null
}
```

**SDK Code**

```python Conversation leases_handoffConversation_example
import requests

url = "https://api.evvahub.com/partner/v1/accounts/cm4r7k2xq0001qz8w3n5v6b2d/conversations/cm4r8a1vz0007qz8wk2j9h4mt/handoff"

payload = {
    "to": "HUMAN",
    "fencingToken": "42",
    "reason": "buyer_asked_for_creator"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```go Conversation leases_handoffConversation_example
package main

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

func main() {

	url := "https://api.evvahub.com/partner/v1/accounts/cm4r7k2xq0001qz8w3n5v6b2d/conversations/cm4r8a1vz0007qz8wk2j9h4mt/handoff"

	payload := strings.NewReader("{\n  \"to\": \"HUMAN\",\n  \"fencingToken\": \"42\",\n  \"reason\": \"buyer_asked_for_creator\"\n}")

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

	req.Header.Add("Authorization", "Bearer <token>")
	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))

}
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.evvahub.com/partner/v1/accounts/cm4r7k2xq0001qz8w3n5v6b2d/conversations/cm4r8a1vz0007qz8wk2j9h4mt/handoff', [
  'body' => '{
  "to": "HUMAN",
  "fencingToken": "42",
  "reason": "buyer_asked_for_creator"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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