# Locate latest source units

Find the latest representation and unit IDs of an owned retained source.

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

## When to use it

Use this after registering or publishing a source if you lost the representation response. Read a unit before selecting its figure_index.

## Request

GET /api/v2/sources/{versionId}/representations/latest

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

### curl

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

### Node.js

```javascript
const response = await fetch("https://api.webcite.co/api/v2/sources/YOUR_VERSIONID/representations/latest", {
  method: "GET",
  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.get(
    "https://api.webcite.co/api/v2/sources/YOUR_VERSIONID/representations/latest",
    headers={"x-api-key": os.environ["WEBCITE_API_KEY"]},
    timeout=(10, 300),
)
response.raise_for_status()
print(response.json())
```

## Response

Returns representationId, parserVersion, and up to 2,000 sourceUnitId entries with locators and states.

## Errors

A foreign or missing source is unavailable. More than 2,000 units returns an explicit size error.

## OpenAPI operation

```json
{
  "path": "/api/v2/sources/{versionId}/representations/latest",
  "method": "GET",
  "operation": {
    "operationId": "SourceVersionController_latestRepresentation",
    "parameters": [
      {
        "in": "path",
        "name": "versionId",
        "required": true,
        "schema": {
          "type": "string"
        }
      }
    ],
    "responses": {
      "200": {
        "description": ""
      }
    },
    "security": [
      {
        "x-api-key": []
      },
      {
        "bearer": []
      }
    ],
    "tags": [
      "Versioned evidence"
    ]
  },
  "schemas": {}
}
```
