# Rigging automatico

> **POST** `/v3/animations/rig`

Aggiungi automaticamente uno scheletro rig a un modello 3D.

## 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ì | — | Fonte del modello. Accetta uno task_id che inizia con `task_` o uno file_token che inizia con `file_` |
| model | stringa | No | `rig-v1.0` | Versione del modello con rigging automatico. Valori possibili: `rig-v2.0`, `rig-v1.0` |
| rig_type | stringa | No | `biped` | Tipo di impianto. Ti consigliamo di chiamare prima `rig-check` per ottenere il valore consigliato. Valori possibili: `biped`, `quadruped`, `hexapod`, `octopod`, `avian`, `serpentine`, `aquatic` |
| spec | stringa | No | `tripo` | Specificazione del rigging. Valori possibili: `tripo`, `mixamo` |
| out_format | stringa | No | `glb` | Formato di uscita. Valori possibili: `glb`, `fbx` |

## Richiedi esempi

### curl

```bash
curl -X POST https://openapi.tripo3d.ai/v3/animations/rig \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer {api_key}" \
  -d '{
    "input": "task_abc123",
    "model": "rig-v2.0",
    "rig_type": "biped",
    "spec": "mixamo",
    "out_format": "glb"
  }'
```

### Python

```python
import requests

url = "https://openapi.tripo3d.ai/v3/animations/rig"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer {api_key}"
}
payload = {
    "input": "task_abc123",
    "model": "rig-v2.0",
    "rig_type": "biped",
    "spec": "mixamo",
    "out_format": "glb"
}

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

### JavaScript

```javascript
const url = "https://openapi.tripo3d.ai/v3/animations/rig";

const response = await fetch(url, {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer {api_key}"
  },
  body: JSON.stringify({
    input: "task_abc123",
    model: "rig-v2.0",
    rig_type: "biped",
    spec: "mixamo",
    out_format: "glb"
  })
});

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à utilizzato per interrogare l'avanzamento e il risultato del rigging automatico |

## 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 | 2002 | Parametro di richiesta non supportato | Controllare i nomi dei parametri del corpo della richiesta e gli intervalli di valori |
| 400 | 2006 | Tipo di attività di origine di input non valido | Confermare che task_id corrisponde a un'attività di modello 3D |
| 400 | 2007 | Lo stato dell'attività di origine non ha esito positivo | Attendi il completamento dell'attività di origine prima di avviare il rigging automatico |
| 403 | 2010 | Crediti insufficienti | Ricaricare i crediti e riprovare |
