> ## Documentation Index
> Fetch the complete documentation index at: https://code.dcycle.io/llms.txt
> Use this file to discover all available pages before exploring further.

# List Custom Database Versions

> Versions of a custom emission factor database

[← Custom Emission Factors](/api-reference/custom-emission-factors/overview)

The versions of a database your organization can see. Record endpoints take a version id as `source_id`.

<Warning>
  **Beta.** Part of the custom emission factors API, currently in beta. The contract may still change before general
  availability.
</Warning>

<RequestExample>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl -X GET "https://api.dcycle.io/v1/emission-factors/custom-databases/5f1c2e7a-3b4d-4e8f-9a01-2c3d4e5f6a7b/versions" \
    -H "x-api-key: ${DCYCLE_API_KEY}" \
    -H "x-organization-id: ${DCYCLE_ORG_ID}"
  ```

  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import os

  import requests

  response = requests.get(
      "https://api.dcycle.io/v1/emission-factors/custom-databases/5f1c2e7a-3b4d-4e8f-9a01-2c3d4e5f6a7b/versions",
      headers={
          "x-api-key": os.environ["DCYCLE_API_KEY"],
          "x-organization-id": os.environ["DCYCLE_ORG_ID"],
      },
      timeout=30,
  )
  response.raise_for_status()
  print(response.json())
  ```

  ```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  const axios = require('axios');

  const response = await axios.get('https://api.dcycle.io/v1/emission-factors/custom-databases/5f1c2e7a-3b4d-4e8f-9a01-2c3d4e5f6a7b/versions', {
    headers: {
      'x-api-key': process.env.DCYCLE_API_KEY,
      'x-organization-id': process.env.DCYCLE_ORG_ID,
    },
  });
  console.log(response.status, response.data);
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={"theme":{"light":"github-light","dark":"github-dark"}}
  [
    {
      "id": "7a8b9c0d-1e2f-4a3b-8c4d-5e6f7a8b9c0d",
      "name": "custom:5f1c2e7a-3b4d-4e8f-9a01-2c3d4e5f6a7b:acme-measured-factors",
      "version": "2024 measured",
      "internal_incremental_version": 1,
      "reference_year": 2024,
      "url": null,
      "record_count": 3,
      "matching_record_count": null
    }
  ]
  ```
</ResponseExample>

## Request

### Headers

<ParamField header="x-api-key" type="string" required>
  Your API key for authentication

  **Example:** `sk_live_1234567890abcdef`
</ParamField>

<ParamField header="x-organization-id" type="string" required>
  Your organization UUID

  **Example:** `a8315ef3-dd50-43f8-b7ce-d839e68d51fa`
</ParamField>

<ParamField path="database_id" type="uuid" required>
  The database id.

  **Example:** `5f1c2e7a-3b4d-4e8f-9a01-2c3d4e5f6a7b`
</ParamField>

<ParamField query="activity_category" type="string">
  Also count, per version, the records linked to this category (`matching_record_count`).

  **Example:** `wastes`
</ParamField>

## Response

An array of versions:

<ResponseField name="id" type="uuid">Version id: the `source_id` used in record paths.</ResponseField>
<ResponseField name="name" type="string">Internal name, generated from the database.</ResponseField>
<ResponseField name="version" type="string">The version label you set.</ResponseField>
<ResponseField name="internal_incremental_version" type="integer">1 for the first version of the database, then 2, 3…</ResponseField>
<ResponseField name="reference_year" type="integer | null">Year the factors refer to.</ResponseField>
<ResponseField name="url" type="string | null">Reference URL.</ResponseField>
<ResponseField name="record_count" type="integer">Number of records.</ResponseField>
<ResponseField name="matching_record_count" type="integer | null">Records linked to the `activity_category` you filtered by; `null` without the filter.</ResponseField>

## Common Errors

### 401 Unauthorized

Missing or invalid API key.

### 403 Forbidden

`LOGGED_USER_NOT_MEMBER`: the API key's user is not a member of the organization in `x-organization-id`.

### 404 CUSTOM\_DATABASE\_NOT\_FOUND

The database does not exist or is not visible to your organization.

## Related Endpoints

<CardGroup cols={2}>
  <Card title="Create Version" icon="plus" href="/api-reference/custom-emission-factors/create-version">
    A new version of the database
  </Card>

  <Card title="List Records" icon="list" href="/api-reference/custom-emission-factors/list-records">
    Records of a version
  </Card>
</CardGroup>
