## Clone a block card

`POST /v1/pages/:pageId/blocks/:blockId/cards/clone`

Clones a card after its source. Without @N Bitrix24 clones the first card and inserts it at the beginning. Indexes shift after a write: inspect the returned cards before the next action.

Requires the `landing` scope; READONLY keys receive 403 before mutation. Page-scoped actions check that the block belongs to the page.

Optional query `scope`: `KNOWLEDGE`, `GROUP` or `MAINPAGE` for that page context; omit for a regular site. IDs must be positive safe integers.

## Examples

### curl — personal key

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/pages/42/blocks/50/cards/clone" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"selector":".landing-block-card@0"}'
```

### JavaScript — personal key

```javascript
const response = await fetch("https://vibecode.bitrix24.com/v1/pages/42/blocks/50/cards/clone", {
  method: "POST",
  headers: {"X-Api-Key": "YOUR_API_KEY", "Content-Type": "application/json"},
  body: JSON.stringify({"selector": ".landing-block-card@0"}),
})
const result = await response.json()
if (!response.ok) throw new Error(result.error.message)
console.log(result.data)
```

### curl — OAuth application

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/pages/42/blocks/50/cards/clone" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"selector":".landing-block-card@0"}'
```

### JavaScript — OAuth application

```javascript
const response = await fetch("https://vibecode.bitrix24.com/v1/pages/42/blocks/50/cards/clone", {
  method: "POST",
  headers: {"X-Api-Key": "YOUR_APP_KEY", "Authorization": "Bearer USER_SESSION_TOKEN", "Content-Type": "application/json"},
  body: JSON.stringify({"selector": ".landing-block-card@0"}),
})
const result = await response.json()
if (!response.ok) throw new Error(result.error.message)
console.log(result.data)
```

## Response

```json
{
  "success": true,
  "data": {
    "cards": {
      ".landing-block-card": [
        {
          "index": 0,
          "content": "<div class=\"landing-block-card\">Example</div>"
        }
      ]
    }
  }
}
```

A refusal after mutation does not undo the Bitrix24 action. On 422/502 after dispatch, read the block first; retrying clone/add can create another card.

## Errors

| HTTP | Code |
|---|---|
| 400 | INVALID_PARAMS / MISSING_REQUIRED_FIELDS / INVALID_SCOPE |
| 401 | MISSING_API_KEY / INVALID_API_KEY / TOKEN_MISSING |
| 403 | SCOPE_DENIED / WRITE_BLOCKED_READONLY_KEY / BITRIX_ACCESS_DENIED |
| 404 | ENTITY_NOT_FOUND |
| 409 | PORTAL_ADDRESS_CHANGED / LANDING_MODULE_NOT_ENABLED |
| 422 | BITRIX_ERROR / BITRIX_NO_EFFECT |
| 429 | RATE_LIMITED |
| 502 | BITRIX_ERROR |
| 503 | SERVICE_UNAVAILABLE |
