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

# Inicio Rápido

> Analiza tu primera llamada en 5 minutos

<Info>
  **Requisitos previos**: Necesitas credenciales de API (`client_id` y `client_secret`).
  Contacta a [support@neuracall.com](mailto:support@neuracall.com) para obtenerlas.
</Info>

## Paso 1: Obtener Token de Acceso

Autentica tu aplicación para obtener un token de acceso:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.neuracall.com/v1/auth \
    -H "Content-Type: application/json" \
    -d '{
      "client_id": "tu_client_id",
      "client_secret": "tu_client_secret"
    }'
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      "https://api.neuracall.com/v1/auth",
      json={
          "client_id": "tu_client_id",
          "client_secret": "tu_client_secret"
      }
  )
  token = response.json()["access_token"]
  print(f"Token obtenido: {token[:50]}...")
  ```

  ```javascript Node.js theme={null}
  const response = await fetch("https://api.neuracall.com/v1/auth", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
      client_id: "tu_client_id",
      client_secret: "tu_client_secret"
    })
  });
  const { access_token } = await response.json();
  console.log(`Token obtenido: ${access_token.substring(0, 50)}...`);
  ```
</CodeGroup>

**Respuesta:**

```json theme={null}
{
  "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
  "expires_at": 1735689600,
  "client_id_audience": "https://api.neuracall.com/call-analysis",
  "scope": "read:call-analysis-requests write:call-analysis-request ..."
}
```

<Note>
  Guarda el `access_token`. Lo necesitaras en todas las llamadas siguientes.
  El token expira en la fecha indicada por `expires_at`.
</Note>

## Paso 2: Subir una Llamada para Análisis

Envia un archivo de audio con la información del agente:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.neuracall.com/v1/call-analysis \
    -H "Authorization: Bearer TU_ACCESS_TOKEN" \
    -F "audio_file=@llamada.mp3" \
    -F "external_id=CALL-2024-001" \
    -F "agent_id=AGT-001" \
    -F "agent_name=Juan Perez" \
    -F "model_name=Evaluación Servicio Cliente"
  ```

  ```python Python theme={null}
  import requests

  with open("llamada.mp3", "rb") as audio:
      response = requests.post(
          "https://api.neuracall.com/v1/call-analysis",
          headers={"Authorization": f"Bearer {token}"},
          files={"audio_file": audio},
          data={
              "external_id": "CALL-2024-001",
              "agent_id": "AGT-001",
              "agent_name": "Juan Perez",
              "model_name": "Evaluación Servicio Cliente"
          }
      )

  analysis = response.json()
  print(f"Análisis creado: {analysis['id']}")
  ```

  ```javascript Node.js theme={null}
  const formData = new FormData();
  formData.append("audio_file", fs.createReadStream("llamada.mp3"));
  formData.append("external_id", "CALL-2024-001");
  formData.append("agent_id", "AGT-001");
  formData.append("agent_name", "Juan Perez");
  formData.append("model_name", "Evaluación Servicio Cliente");

  const response = await fetch("https://api.neuracall.com/v1/call-analysis", {
    method: "POST",
    headers: { "Authorization": `Bearer ${access_token}` },
    body: formData
  });
  const analysis = await response.json();
  console.log(`Análisis creado: ${analysis.id}`);
  ```
</CodeGroup>

**Respuesta (201 Created):**

```json theme={null}
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "external_id": "CALL-2024-001",
  "agent_id": "AGT-001",
  "agent_name": "Juan Perez",
  "status": "PENDING",
  "created_at": "2024-01-15T10:30:00Z"
}
```

<Tip>
  **Formatos soportados**: MP3, WAV, M4A, FLAC, OGG, WEBM
</Tip>

## Paso 3: Consultar el Resultado

El análisis se procesa de forma asincrona. Consulta el estado hasta qué este completo:

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.neuracall.com/v1/call-analysis/550e8400-e29b-41d4-a716-446655440000 \
    -H "Authorization: Bearer TU_ACCESS_TOKEN"
  ```

  ```python Python theme={null}
  import time

  analysis_id = "550e8400-e29b-41d4-a716-446655440000"

  while True:
      response = requests.get(
          f"https://api.neuracall.com/v1/call-analysis/{analysis_id}",
          headers={"Authorization": f"Bearer {token}"}
      )
      result = response.json()

      if result["status"] == "PROCESS_COMPLETED":
          print(f"NeuraScore: {result['score_percentage']}%")
          print(f"Resumen: {result['summary']}")
          break
      elif result["status"] == "ERROR":
          print(f"Error: {result['error_message']}")
          break
      else:
          print(f"Estado: {result['status']}")
          time.sleep(5)
  ```
</CodeGroup>

**Respuesta (completado):**

```json theme={null}
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "external_id": "CALL-2024-001",
  "status": "PROCESS_COMPLETED",
  "total_score": 425,
  "expected_score": 500,
  "score_percentage": 85.0,
  "summary": "El agente resolvio eficientemente una consulta de facturación...",
  "insights": [
    "Excelente manejo del saludo inicial",
    "Oportunidad de mejora en el cierre de la llamada"
  ],
  "keywords": ["facturación", "reembolso", "satisfacción"],
  "neurascore_result": [
    {
      "name": "Apertura",
      "total_score": 45,
      "expected_total_score": 50,
      "score_percentage": 90.0,
      "variables": [...]
    }
  ]
}
```

## Estados del Análisis

| Estado                                | Descripción                                 |
| ------------------------------------- | ------------------------------------------- |
| `PENDING`                             | Solicitud recibida, esperando procesamiento |
| `AUDIO_TRANSCRIPTION_IN_PROGRESS`     | Transcribiendo el audio                     |
| `TRANSCRIPTION_ANALYZE_IN_PROGRESS`   | Analizando la transcripción                 |
| `TRANSCRIPTION_SUMMARIZE_IN_PROGRESS` | Generando resumen e insights                |
| `PROCESS_COMPLETED`                   | Análisis completado exitosamente            |
| `ERROR`                               | Error durante el procesamiento              |

## Siguientes Pasos

<CardGroup cols={2}>
  <Card title="Entender NeuraScore" icon="chart-line" href="/concepts/neurascore">
    Aprende a interpretar las puntuaciónes
  </Card>

  <Card title="Configurar Modelos" icon="sliders" href="/concepts/analysis-models">
    Personaliza los criterios de evaluación
  </Card>

  <Card title="Ver el Dashboard" icon="chart-pie" href="/user-guide/dashboard">
    Explora las métricas agregadas
  </Card>

  <Card title="API Reference" icon="code" href="/api-reference/introduction">
    Documentación completa de la API
  </Card>
</CardGroup>
