# Validation error

**HTTP status:** `400 Bad Request`

**Content-Type:** `application/problem+json`

**type:** `https://truescreen.redocly.app/errors/validation-error`

This error is returned when the request payload or its parameters fail validation. Common causes include: missing required fields, invalid value formats, non-existent referenced resources, or business rule violations.

## Associated error codes

| Code | Message | Cause |
|  --- | --- | --- |
| `TS-001` | Malformed payload. | Unparseable JSON body or structure not conforming to the schema |
| `TS-002` | Validation data error. | Missing required field (e.g. `title`, `files`, `template_token`) |
| `TS-003` | Relative resource not found. | `template_token` does not match any flow template |
| `TS-004` | Flow data validation error. | Values in `flow_data` do not match the flow template schema |
| `TS-005` | Sign data validation error. | Values in `sign_data` do not match the flow template schema |
| `TS-006` | Attachment already linked to Template. | The attachment is already associated with a template |
| `TS-007` | On before create function not found. | Invalid template internal configuration |
| `TS-008` | Insufficient credits available. | Insufficient credit balance to complete the operation |
| `TS-011` | No certification attachments found. | `upload_session_token` has no associated attachments |
| `TS-012` | A certification has already been created for this upload session token. | The `upload_session_token` has already been used to create a certification |
| `TS-013` | Not all files have been uploaded. | Some registered files were not uploaded before creation |
| `TS-901` | This True Link has already been used to create a certification. | The True Link has already been used |


## Example response


```json
{
  "type": "https://truescreen.redocly.app/errors/validation-error",
  "title": "Validation error",
  "status": 400,
  "detail": "must have required property 'template_token'.",
  "code": "TS-002"
}
```

## How to resolve

1. Check the **`detail`** field to see which field or constraint failed validation.
2. Use **`code`** to identify the error category in the table above.
3. Verify the request payload against the schema documented in the [OpenAPI spec](/openapi).
4. For `TS-008` (insufficient credits): check your balance with `GET /v1/credits`.