# Codice Fiscale (TIN)

Validazione formale (non controlla se esista realmente) di un codice fiscale all'interno dell'Unione Europea

## Controlla la validità formale di un codice fiscale

<mark style="color:green;">`POST`</mark> `https://api.gsped.it/[ISTANZA]/validation/tin`

#### Headers

| Name                                        | Type   | Description             |
| ------------------------------------------- | ------ | ----------------------- |
| x-api-key<mark style="color:red;">\*</mark> | String | APIKEY fornita da Gsped |

#### Request Body

| Name                                      | Type   | Description                |
| ----------------------------------------- | ------ | -------------------------- |
| country<mark style="color:red;">\*</mark> | String | Nazione c.f. in ISO-2 code |
| value<mark style="color:red;">\*</mark>   | String | Valore c.f. da controllare |

{% tabs %}
{% tab title="200: OK Chiamata corretta" %}
Chiamata effettuata, verificare se valido dalla risposta (campo isValid)

```json
{
    "result": {
        "isValid": true, // cumulativo di sintassi e struttura corrette
        "infos": {
            "countryCode": "IT",
            "tinNumber": "RSSMRA80A01A182N",
            "validStructure": true,
            "validSyntax": true,
            "statusCode": 200 // risposta servizio di validazione interrogato
        }
    },
    "code": 200 // codice risposta Gsped ripetuto nel payload
}
```

{% endtab %}

{% tab title="400: Bad Request Dati non corretti" %}
Campo error con descrizione dell'errore

```json
{
    "error": "country: This value should have exactly 2 characters.",
    "code": 400
}
```

{% endtab %}

{% tab title="500: Internal Server Error Errore durante la validazione" %}

```json
{
    "error": "Errore durante il processo di validazione",
    "code": 500
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://apidocs.gsped.com/validation/validation/codice-fiscale-tin.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
