API Quickstart
Base URL da API:
https://api.migrai.com.br
Documentacao interativa:
1) Configure autenticacao
Use uma API key no header Authorization: Bearer <API_KEY>.
Exemplo:
export MIGRAI_API_BASE="https://api.migrai.com.br"
export MIGRAI_API_KEY="<SUA_API_KEY>"
2) Valide a identidade atual
curl -sS "$MIGRAI_API_BASE/api/v1/users/me" \
-H "Authorization: Bearer $MIGRAI_API_KEY"
3) Inicie uma conversa
curl -sS -X POST "$MIGRAI_API_BASE/api/v1/app-conversations" \
-H "Authorization: Bearer $MIGRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "Primeira conversa via API",
"initial_message": {
"role": "user",
"content": [
{"type": "text", "text": "Crie um plano de migration para API REST"}
],
"run": true
}
}'
Resposta esperada: um start task com id e status.
4) Acompanhe o start task
curl -sS "$MIGRAI_API_BASE/api/v1/app-conversations/start-tasks?ids=<TASK_ID>" \
-H "Authorization: Bearer $MIGRAI_API_KEY"
Quando status=READY, o campo app_conversation_id fica disponivel.
5) Leia os eventos da conversa
curl -sS "$MIGRAI_API_BASE/api/v1/conversation/<CONVERSATION_ID>/events/search?limit=50" \
-H "Authorization: Bearer $MIGRAI_API_KEY"
Proximo passo: Autenticacao.