cURL
curl --request GET \ --url http://api.gu1.ai/entities \ --header 'Authorization: Bearer <token>'
{ "success": true, "entities": [ { "id": "<string>", "entityType": "<string>", "entityData": {}, "relationships": [ {} ], "riskScore": 123, "createdAt": "<string>", "updatedAt": "<string>" } ], "pagination": { "total": 123, "limit": 123, "offset": 123, "hasMore": true } }
List all payment method entities with filtering and pagination
GET http://api.gu1.ai/entities?entityType=payment_method
Authorization: Bearer YOUR_API_KEY
"payment_method"
createdAt
updatedAt
riskScore
asc
desc
curl -X GET "http://api.gu1.ai/entities?entityType=payment_method" \ -H "Authorization: Bearer YOUR_API_KEY"
curl -X GET "http://api.gu1.ai/entities?entityType=payment_method&relationshipWith=person-uuid-123" \ -H "Authorization: Bearer YOUR_API_KEY"
curl -X GET "http://api.gu1.ai/entities?entityType=payment_method&limit=25&offset=0&sortBy=createdAt&sortOrder=desc" \ -H "Authorization: Bearer YOUR_API_KEY"
Show properties
{ "success": true, "entities": [ { "id": "payment-method-uuid-123", "entityType": "payment_method", "entityData": { "paymentMethod": { "type": "credit_card", "last4": "4242", "brand": "visa", "expiryMonth": "12", "expiryYear": "2025", "holderName": "John Doe", "issuerCountry": "BR", "funding": "credit" } }, "relationships": [ { "targetEntityId": "person-uuid-123", "relationshipType": "owns", "strength": 1.0 } ], "riskScore": 15, "createdAt": "2024-01-15T10:00:00.000Z", "updatedAt": "2024-12-23T10:00:00.000Z" }, { "id": "payment-method-uuid-456", "entityType": "payment_method", "entityData": { "paymentMethod": { "type": "bank_account", "accountType": "checking", "bank": "Banco do Brasil", "currency": "BRL", "holderName": "John Doe" } }, "relationships": [ { "targetEntityId": "person-uuid-123", "relationshipType": "owns", "strength": 1.0 } ], "riskScore": 5, "createdAt": "2024-02-10T14:30:00.000Z", "updatedAt": "2024-12-23T10:00:00.000Z" } ], "pagination": { "total": 2, "limit": 50, "offset": 0, "hasMore": false } }
async function findPersonCreditCards(personId) { const response = await fetch( `http://api.gu1.ai/entities?entityType=payment_method&relationshipWith=${personId}`, { headers: { 'Authorization': 'Bearer YOUR_API_KEY' } } ); const { entities } = await response.json(); // Filter for credit cards only const creditCards = entities.filter( e => e.entityData.paymentMethod.type === 'credit_card' ); return creditCards; }
async function findHighRiskPaymentMethods(minRiskScore = 70) { let allHighRisk = []; let offset = 0; const limit = 100; let hasMore = true; while (hasMore) { const response = await fetch( `http://api.gu1.ai/entities?` + new URLSearchParams({ entityType: 'payment_method', limit, offset, sortBy: 'riskScore', sortOrder: 'desc' }), { headers: { 'Authorization': 'Bearer YOUR_API_KEY' } } ); const { entities, pagination } = await response.json(); // Filter by risk score const highRisk = entities.filter(e => e.riskScore >= minRiskScore); allHighRisk = allHighRisk.concat(highRisk); // If we got entities with risk score below threshold, stop if (entities.length > 0 && entities[entities.length - 1].riskScore < minRiskScore) { break; } hasMore = pagination.hasMore; offset += limit; } return allHighRisk; }
async function groupPaymentMethodsByType(personId) { const response = await fetch( `http://api.gu1.ai/entities?entityType=payment_method&relationshipWith=${personId}`, { headers: { 'Authorization': 'Bearer YOUR_API_KEY' } } ); const { entities } = await response.json(); const grouped = entities.reduce((acc, pm) => { const type = pm.entityData.paymentMethod.type; if (!acc[type]) { acc[type] = []; } acc[type].push(pm); return acc; }, {}); return grouped; } // Usage const grouped = await groupPaymentMethodsByType('person-uuid-123'); console.log(`Credit cards: ${grouped.credit_card?.length || 0}`); console.log(`Bank accounts: ${grouped.bank_account?.length || 0}`); console.log(`PIX keys: ${grouped.pix?.length || 0}`);
{ "error": "Invalid query parameters", "details": { "limit": "Must be between 1 and 100" } }
{ "error": "Invalid or missing API key" }
Was this page helpful?