> 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

# Pin a message

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

Pins one message in the conversation, replacing any message pinned before.

The fan sees the pin too.

**Conversation leases**

Your application's pin is coordinated like its send ([conversation leases](/conversation-leases)). Send the
`fencingToken` in the body. EVVA decides in the same transaction as the pin, so a takeover and the pin are
always ordered.

- While a lease is live, only your application's own lease admits the pin, with its current `fencingToken`. Under a
  lease held by a person on the agency's team or by another application, or without the token, it is refused with
  `409 LEASE_HELD` and `Retry-After` set to the lease's remaining time.
- A `fencingToken` that is not your lease's current one is refused with `409 STALE_FENCING_TOKEN`. Once the lease is
  released or has expired, send no token: an old one is refused the same way.
- After a person on the agency's team replies in the conversation, the pin is refused with `409 AUTOMATION_PAUSED`
  for the agency's pause window, with `Retry-After`. While a handoff to a person has been taken up, it is refused with
  `409 AUTOMATION_PAUSED` and no `Retry-After`, until a person hands the conversation back. The creator's own replies
  do not pause it.

**Errors**

- `400 INVALID_REQUEST` — `messageRef` is missing, or the `fencingToken` is malformed.
- `404 NOT_FOUND` — the message is not in this conversation.
- `409 LEASE_HELD` — a lease held by someone else is live, or you sent no `fencingToken` while a lease is live.
  `Retry-After` gives the lease's remaining time.
- `409 STALE_FENCING_TOKEN` — the `fencingToken` is not your lease's current one.
- `409 AUTOMATION_PAUSED` — a person on the agency's team is handling the conversation. See **Conversation leases**.

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

Reference: https://developers.evvahub.com/api-reference/chat/pin-message

## 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 an object.

- `messageRef` (string, required) — The message to pin.
- `fencingToken` (PartnerV1AccountsCreatorIdConversationsConversationIdPinPutRequestBodyContentApplicationJsonSchemaFencingToken, optional) — The current fencing token of your application's own live lease on the conversation. Required while a lease is live; send none when no lease is live.

## Response

### 204

Pinned. Pinning the message that is already pinned answers `204` again.

## 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

Not your creator, or not with this token: `GRANT_REVOKED` (no active link to the creator), `NOT_ASSIGNED`, `OAUTH_SCOPE_MISSING` (the creator has not consented to the scope), `INSUFFICIENT_SCOPE` (the token lacks it), `CREATOR_CONTEXT_MISMATCH`, `AGENCY_SUSPENDED`.

- `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

Conflicts with the current state: `IDEMPOTENCY_KEY_REUSED` (the key was used for a different request), an approval that is still pending or already used, 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.

### 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

### PartnerV1AccountsCreatorIdConversationsConversationIdPinPutRequestBodyContentApplicationJsonSchemaFencingToken

The current fencing token of your application's own live lease on the conversation. Required while a lease is live; send none when no lease is live.

- 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
{
  "messageRef": "cm4r9c3hd000bqz8wp6t1x8ny"
}
```

**SDK Code**

```python Chat_pinMessage_example
import requests

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

payload = { "messageRef": "cm4r9c3hd000bqz8wp6t1x8ny" }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```go Chat_pinMessage_example
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"messageRef\": \"cm4r9c3hd000bqz8wp6t1x8ny\"\n}")

	req, _ := http.NewRequest("PUT", 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 Chat_pinMessage_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.evvahub.com/partner/v1/accounts/cm4r7k2xq0001qz8w3n5v6b2d/conversations/cm4r8a1vz0007qz8wk2j9h4mt/pin', [
  'body' => '{
  "messageRef": "cm4r9c3hd000bqz8wp6t1x8ny"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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