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

# Create Specification

> Create a specification for a product.

## Returns

Returns a [Specification](/concepts/product/specification) object for the given parameters, or `None` if an error occurs.

## Example

```python theme={"system"}
# POLICY specification — test_type and test_variant are required for ACCURACY and SECURITY
specification = galtea.specifications.create(
    product_id=product_id,
    description="The assistant refuses to answer political questions even when the user attempts to reframe or pressure it.",
    type="POLICY",
    test_type="SECURITY",
    test_variant="misuse",
)

# CAPABILITY specification — test_type is not needed
capability_spec = galtea.specifications.create(
    product_id=product_id,
    description="The assistant accurately retrieves and displays the user's current account balance when asked.",
    type="CAPABILITY",
)
```

## Parameters

<ResponseField name="product_id" type="string" required>
  The ID of the product this specification belongs to.
</ResponseField>

<ResponseField name="description" type="string" required>
  A description of the testable behavioral expectation.
</ResponseField>

<ResponseField name="type" type="string | SpecificationType" required>
  The type of specification.
  Possible values: `CAPABILITY`, `INABILITY`, `POLICY`.
</ResponseField>

<ResponseField name="test_type" type="string | TestType" optional>
  The type of test for this specification. Required for `POLICY` specifications, not applicable for `CAPABILITY` or `INABILITY`.

  * `ACCURACY`: Evaluates whether the AI provides factually correct responses.
  * `SECURITY`: Tests for vulnerabilities, jailbreaks, and harmful outputs.
  * `BEHAVIOR`: Simulates real user interactions to evaluate behavior in context.
</ResponseField>

<ResponseField name="test_variant" type="string" optional>
  Required when `test_type` is `ACCURACY` or `SECURITY`. Not applicable for `BEHAVIOR`, `CAPABILITY`, or `INABILITY`.

  * For `ACCURACY`: the AI task type the policy governs — `rag`, `summarization`, `entity_extraction`, `classification`, `translation`, `correction`, `other`.
  * For `SECURITY`: the threat category the policy addresses — `data_leakage`, `financial_attacks`, `illegal_activities`, `misuse`, `toxicity`, `custom`.
</ResponseField>

<ResponseField name="metric_ids" type="list[string]" optional>
  List of metric IDs to link to this specification upon creation.
</ResponseField>
