# UV intelligente

> **POST** `/v3/mesh/uv`

Esegue di nuovo l'unwrap UV di un modello 3D e riporta texture, rigging e animazioni esistenti sul nuovo layout.

Ogni attività costa **20** crediti. Il risultato contiene `model_url` e un'anteprima del layout UV `uv_render_url`. Il modello in ingresso non deve superare **80.000 triangoli equivalenti** (un quad conta come due); i modelli più grandi vengono accettati alla creazione, ma l'attività fallisce e i crediti vengono rimborsati.

## Richiedi parametri

### Richiedi intestazioni

| Parametro | Digitare | Obbligatorio | Predefinito | Descrizione |
| :-: | :-: | :-: | :-: | :-: |
| Content-Type | stringa | Sì | — | `application/json` |
| Authorization | stringa | Sì | — | `Bearer {api_key}` |

### Richiedi corpo

| Parametro | Digitare | Obbligatorio | Predefinito | Descrizione |
| :-: | :-: | :-: | :-: | :-: |
| input | stringa | Sì | — | Origine del modello. Accetta un task_id, un file_token o un URL |
| model | stringa | No | `default` | Versione del modello UV intelligente. È supportato solo `default` |
| bake | booleano | No | `true` | Esegue il bake delle texture esistenti sul nuovo layout UV. Con `false` restituisce solo la geometria con UV |
| export_orientation | stringa | No | — | Orientamento del modello esportato: `+x`, `-x`, `+y` o `-y` |
| compress | stringa | No | — | Tipo di compressione. `geometry`: compressione meshopt |

## Richiedi esempi

### curl

```bash
curl -X POST https://openapi.tripo3d.ai/v3/mesh/uv \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer {api_key}" \
  -d '{
    "input": "task_abc123",
    "bake": true
  }'
```

### Python

```python
import requests

url = "https://openapi.tripo3d.ai/v3/mesh/uv"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer {api_key}"
}
payload = {
    "input": "task_abc123",
    "bake": True
}

response = requests.post(url, headers=headers, json=payload)
print(response.json())
```

### JavaScript

```javascript
const url = "https://openapi.tripo3d.ai/v3/mesh/uv";

const response = await fetch(url, {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer {api_key}"
  },
  body: JSON.stringify({
    input: "task_abc123",
    bake: true
  })
});

const data = await response.json();
console.log(data);
```

## Risposta

### Risposta riuscita

```json
{
  "code": 0,
  "data": {
    "task_id": "task_def456"
  }
}
```

### Campi di risposta

| Parametro | Digitare | Descrizione |
| :-: | :-: | :-: |
| code | intero | Codice di stato. `0` indica successo |
| data.task_id | stringa | Identificatore univoco dell'attività per interrogare avanzamento e risultato |

## Codici di errore

| HTTP Codice di stato | Codice errore | Descrizione | Raccomandazione |
| :-: | :-: | :-: | :-: |
| 429 | 2000 | Limite di generazione superato | Ridurre la frequenza delle richieste e riprovare più tardi |
| 400 | 1004 | Parametro o input non valido | Controlla nomi, valori e origine dell'input |
| 403 | 2010 | Crediti insufficienti | Ricaricare i crediti e riprovare |
