Skip to main content
GET
/
users
/
me
Obter Perfil
curl --request GET \
  --url https://api.example.com/users/me
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "email": "[email protected]",
  "nome": "João Silva",
  "telefone": "+5511999999999",
  "cpf": "12345678900",
  "avatar_url": "https://storage.indiqai.com/avatars/joao.jpg",
  "referral_code": "JOAO2024",
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-06-20T14:15:00Z",
  "stats": {
    "total_points": 2500,
    "total_referrals": 12,
    "total_rewards_redeemed": 5
  }
}

Obter Perfil

Retorna os dados completos do usuário atualmente autenticado.

Request

curl -X GET https://api.indiqai.com/api/v1/users/me \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

Response

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "email": "[email protected]",
  "nome": "João Silva",
  "telefone": "+5511999999999",
  "cpf": "12345678900",
  "avatar_url": "https://storage.indiqai.com/avatars/joao.jpg",
  "referral_code": "JOAO2024",
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-06-20T14:15:00Z",
  "stats": {
    "total_points": 2500,
    "total_referrals": 12,
    "total_rewards_redeemed": 5
  }
}

Campos da Resposta

id
string
UUID único do usuário
email
string
Email do usuário
nome
string
Nome completo
telefone
string
Telefone no formato internacional
cpf
string
CPF (apenas números)
avatar_url
string
URL da foto de perfil (pode ser null)
referral_code
string
Código único para indicações
stats
object
Estatísticas agregadas do usuário

Uso no Frontend

import { useQuery } from '@tanstack/react-query';
import { apiClient } from '@/lib/api-client';

export function useProfile() {
  return useQuery({
    queryKey: ['profile'],
    queryFn: async () => {
      const { data } = await apiClient.get('/users/me');
      return data;
    }
  });
}

// No componente
function ProfilePage() {
  const { data: user, isLoading } = useProfile();
  
  if (isLoading) return <Loading />;
  
  return (
    <div>
      <h1>{user.nome}</h1>
      <p>{user.email}</p>
    </div>
  );
}