# Transfer Membership - Move a Subscription Between Users via API

> Transfer a membership from one user to another on a Telegram or Discord subscription bot project.

Source: https://docs.botsubscription.com/api/memberships/transfer/

Move an existing membership for a specific plan from one user to another—useful when a customer changes their account, or support needs to correct a purchase made under the wrong identity.

Keep `membership_data` as opaque metadata; its example keys are not a fixed schema. A `null` end date means clients must handle membership access without a finite end date.

<ApiEndpoint method="POST" endpoint="/v2/projects/{project_id}/memberships/{user_id}/{plan_id}/transfer" />

<ApiAuthorization type="Bearer API Key" />

**API key access:** Unrestricted project API key required. Restricted keys cannot call this endpoint.

<ApiSection title="Path Parameters">
  <ApiParameter name="project_id" type="string" required description="The unique identifier of the project." />
  <ApiParameter name="user_id" type="string" required description="The source user currently holding the membership." />
  <ApiParameter name="plan_id" type="string" required description="The plan UUID whose membership should be transferred." />
</ApiSection>

<ApiSection title="Request Body">
  <ApiParameter name="to" type="string" required description="Recipient platform user ID as a string. Preserve all digits of a Discord snowflake." />
</ApiSection>

<ApiSamplePane>

<ApiRequestSample title="Request">

```bash
curl -X POST "https://api.botsubscription.com/v2/projects/YOUR_PROJECT_ID/memberships/123456789012345678/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa/transfer" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "987654321098765432"
  }'
```

```javascript
const project_id = 'YOUR_PROJECT_ID';
const user_id = '123456789012345678';
const plan_id = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa';
const response = await fetch(`https://api.botsubscription.com/v2/projects/${project_id}/memberships/${user_id}/${plan_id}/transfer`, {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    to: '987654321098765432'
  })
});
const data = await response.json();
```

```python
import requests

project_id = 'YOUR_PROJECT_ID'
user_id = '123456789012345678'
plan_id = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'
response = requests.post(
    f'https://api.botsubscription.com/v2/projects/{project_id}/memberships/{user_id}/{plan_id}/transfer',
    headers={
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json'
    },
    json={
        'to': '987654321098765432'
    }
)
data = response.json()
```

```php
$project_id = 'YOUR_PROJECT_ID';
$user_id = '123456789012345678';
$plan_id = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.botsubscription.com/v2/projects/{$project_id}/memberships/{$user_id}/{$plan_id}/transfer");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer YOUR_API_KEY',
    'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
    'to' => '987654321098765432'
]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
```

</ApiRequestSample>

<ApiResponseTabs>
  <ApiResponse status={200} description="Membership transferred">

```json
{
  "ok": true,
  "request_id": "11111111-1111-1111-1111-111111111111",
  "method": "POST",
  "path": "/v2/projects/11111111-1111-4111-8111-111111111111/memberships/123456789012345678/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa/transfer",
  "code": 200,
  "data": {
    "membership_id": "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb",
    "plan_id": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
    "user_id": "987654321098765432",
    "membership_start_date": "2025-12-29T10:32:27.560Z",
    "membership_end_date": "2026-01-12T10:32:27.560Z",
    "payment_request_id": null,
    "access_token_id": null,
    "membership_paid_through_date": null,
    "membership_last_reminder_sent": null,
    "membership_data": {
      "support_reference": "TRANSFER-EXAMPLE"
    }
  },
  "message": "Membership transferred successfully"
}
```

  </ApiResponse>
  <ApiResponse status={200} description="Membership without a finite end date">

```json
{
  "ok": true,
  "request_id": "11111111-1111-1111-1111-111111111111",
  "method": "POST",
  "path": "/v2/projects/11111111-1111-4111-8111-111111111111/memberships/123456789012345678/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa/transfer",
  "code": 200,
  "data": {
    "membership_id": "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb",
    "plan_id": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
    "user_id": "987654321098765432",
    "membership_start_date": "2025-12-29T10:32:27.560Z",
    "payment_request_id": null,
    "membership_end_date": null
  },
  "message": "Membership transferred successfully"
}
```

  </ApiResponse>
  <ApiResponse status={404} description="No matching membership for the source user and plan">

```json
{
  "ok": false,
  "request_id": "11111111-1111-1111-1111-111111111111",
  "method": "POST",
  "path": "/v2/projects/11111111-1111-4111-8111-111111111111/memberships/123456789012345678/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa/transfer",
  "code": 404,
  "error": {
    "error_code": "NOT_FOUND",
    "message": "Membership not found"
  }
}
```

  </ApiResponse>
  <ApiResponse status={401} description="Invalid or expired API key">

```json
{
  "ok": false,
  "request_id": "44444444-4444-4444-8444-444444444444",
  "method": "POST",
  "path": "/v2/projects/11111111-1111-4111-8111-111111111111/memberships/123456789012345678/aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa/transfer",
  "code": 401,
  "error": {
    "message": "Invalid or expired authentication token.",
    "error_code": "UNAUTHORIZED"
  }
}
```

  </ApiResponse>
</ApiResponseTabs>

</ApiSamplePane>
