# Register retained source bytes

Register immutable original bytes for an uploaded asset owned by the caller.

Documentation index: https://webcite.co/llms.txt
Canonical page: https://webcite.co/api-docs/register-source
API origin: https://api.webcite.co
Authentication: x-api-key header. Keep keys on your server.

## When to use it

Send multipart/form-data with assetId and file. The asset must already belong to your account. If upload_file already returned source_version_id, use that retained ID directly.

## Request

POST /api/v2/sources

No fixed public credit price is specified for this V2 operation.

### curl

```curl
curl --fail-with-body -X POST 'https://api.webcite.co/api/v2/sources' \
  -H "x-api-key: $WEBCITE_API_KEY"
```

### Node.js

```javascript
const response = await fetch("https://api.webcite.co/api/v2/sources", {
  method: "POST",
  headers: {
    "x-api-key": process.env.WEBCITE_API_KEY,
  },
});
if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`);
console.log(await response.json());
```

### python

```python
import os
import requests

response = requests.post(
    "https://api.webcite.co/api/v2/sources",
    headers={"x-api-key": os.environ["WEBCITE_API_KEY"]},
    timeout=(10, 300),
)
response.raise_for_status()
print(response.json())
```

## Response

Returns sourceVersionId, assetId, bytesHash, and source metadata. Keep the version ID for representation publication.

## Errors

A missing file or foreign asset is rejected. Source bytes and asset ownership are checked before publication.

## OpenAPI operation

```json
{
  "path": "/api/v2/sources",
  "method": "POST",
  "operation": {
    "operationId": "SourceVersionController_register",
    "parameters": [],
    "responses": {
      "201": {
        "description": ""
      }
    },
    "security": [
      {
        "x-api-key": []
      },
      {
        "bearer": []
      }
    ],
    "tags": [
      "Versioned evidence"
    ]
  },
  "schemas": {}
}
```
