> ## 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.

# Validate LCA

> Validate an LCA portfolio against a methodology and impact category

# Validate LCA

Validates an LCA portfolio by checking that the specified processes can produce valid impact calculations for a given methodology and impact category. Use this before requesting impact calculations to ensure all required data is in place.

## 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>

### Path Parameters

<ParamField path="lca_id" type="string" required>
  UUID of the LCA portfolio to validate

  **Example:** `550e8400-e29b-41d4-a716-446655440000`
</ParamField>

### Query Parameters

<ParamField query="methodology_id" type="string" required>
  UUID of the methodology to validate against

  **Example:** `d4e5f6a7-b8c9-0123-def4-567890123456`
</ParamField>

<ParamField query="impact_category" type="string" required>
  Impact category identifier to validate

  **Common values:** `gwp`, `ap`, `ep`, `pocp`, `adp`
</ParamField>

<ParamField query="process_id_list" type="array[string]" required>
  List of process block UUIDs to include in the validation

  **Example:** `process_id_list=uuid1&process_id_list=uuid2`
</ParamField>

## Example

<CodeGroup>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl -X GET "https://api.dcycle.io/v1/lca/validate/${LCA_ID}?methodology_id=${METHODOLOGY_ID}&impact_category=gwp&process_id_list=${PROCESS_ID_1}&process_id_list=${PROCESS_ID_2}" \
    -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 requests
  import os

  lca_id = "550e8400-e29b-41d4-a716-446655440000"

  response = requests.get(
      f"https://api.dcycle.io/v1/lca/validate/{lca_id}",
      headers={
          "x-api-key": os.getenv("DCYCLE_API_KEY"),
          "x-organization-id": os.getenv("DCYCLE_ORG_ID"),
      },
      params={
          "methodology_id": "d4e5f6a7-b8c9-0123-def4-567890123456",
          "impact_category": "gwp",
          "process_id_list": [
              "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
              "b2c3d4e5-f6a7-8901-bcde-f12345678901",
          ],
      },
  )

  is_valid = response.json()
  if is_valid:
      print("LCA is valid — ready for impact calculation")
  else:
      print("LCA validation failed — check process data")
  ```

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

  const lcaId = '550e8400-e29b-41d4-a716-446655440000';

  axios.get(`https://api.dcycle.io/v1/lca/validate/${lcaId}`, {
    headers: {
      'x-api-key': process.env.DCYCLE_API_KEY,
      'x-organization-id': process.env.DCYCLE_ORG_ID,
    },
    params: {
      methodology_id: 'd4e5f6a7-b8c9-0123-def4-567890123456',
      impact_category: 'gwp',
      process_id_list: [
        'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
        'b2c3d4e5-f6a7-8901-bcde-f12345678901',
      ],
    },
  })
  .then(({ data }) => {
    console.log(data ? 'Valid' : 'Invalid');
  });
  ```
</CodeGroup>

### Successful Response

Returns `true` if the LCA portfolio is valid for the specified parameters, `false` otherwise.

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
true
```

## Common Errors

### 401 Unauthorized

**Cause:** Missing or invalid API key

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{"detail": "Invalid API key for organization", "code": "INVALID_API_KEY"}
```

### 403 Forbidden

**Cause:** The authenticated user is not a member of the organization

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{"detail": "Logged User is not Member of Organization", "code": "LOGGED_USER_NOT_MEMBER"}
```

### 404 Not Found

**Cause:** LCA portfolio not found or doesn't belong to your organization

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{"detail": "LCA Portfolio not found"}
```

### 422 Unprocessable Entity

**Cause:** Missing required query parameters

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "detail": [
    {
      "loc": ["query", "methodology_id"],
      "msg": "field required",
      "type": "value_error.missing"
    }
  ]
}
```

## Related Endpoints

<CardGroup cols={2}>
  <Card title="Get LCA Impacts" icon="chart-bar" href="/api-reference/lca/impacts">
    Calculate impacts after validation passes
  </Card>

  <Card title="Get LCA Portfolio" icon="magnifying-glass" href="/api-reference/lca/get">
    View portfolio details
  </Card>

  <Card title="LCA Dashboard" icon="chart-pie" href="/api-reference/lca/dashboard">
    View aggregated environmental impact results
  </Card>
</CardGroup>
