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

# Get Payment Method

> Retrieve a payment method entity by ID — in the gu1 entity model for card, account, and wallet records, with examples for get use cases.

## Overview

Retrieves detailed information about a specific payment method entity including its data, relationships, and metadata.

## Endpoint

```
GET http://api.gu1.ai/entities/{id}
```

## Authentication

Requires a valid API key in the Authorization header:

```bash theme={null}
Authorization: Bearer YOUR_API_KEY
```

## Path Parameters

<ParamField path="id" type="string" required>
  UUID of the payment method entity to retrieve
</ParamField>

## Example Requests

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "http://api.gu1.ai/entities/payment-method-uuid-123" \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'http://api.gu1.ai/entities/payment-method-uuid-123',
    {
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY'
      }
    }
  );

  const paymentMethod = await response.json();
  console.log(paymentMethod.entityData.paymentMethod);
  ```

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

  response = requests.get(
      'http://api.gu1.ai/entities/payment-method-uuid-123',
      headers={
          'Authorization': 'Bearer YOUR_API_KEY'
      }
  )

  payment_method = response.json()
  print(payment_method['entityData']['paymentMethod'])
  ```
</CodeGroup>

## Response

<ResponseField name="success" type="boolean">
  Whether the request was successful
</ResponseField>

<ResponseField name="id" type="string">
  UUID of the payment method entity
</ResponseField>

<ResponseField name="entityType" type="string">
  Always `"payment_method"`
</ResponseField>

<ResponseField name="entityData" type="object">
  Payment method data

  <Expandable title="properties">
    <ResponseField name="paymentMethod" type="object">
      Payment method details (structure varies by type)
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="relationships" type="array">
  Array of relationships to other entities (owners, transactions, devices)
</ResponseField>

<ResponseField name="metadata" type="object">
  Additional metadata
</ResponseField>

<ResponseField name="riskScore" type="number">
  Calculated risk score (if analyzed)
</ResponseField>

<ResponseField name="riskFactors" type="array">
  Array of identified risk factors
</ResponseField>

<ResponseField name="createdAt" type="string">
  ISO 8601 timestamp of creation
</ResponseField>

<ResponseField name="updatedAt" type="string">
  ISO 8601 timestamp of last update
</ResponseField>

## Response Examples

### Credit Card Response

```json theme={null}
{
  "success": true,
  "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",
      "bin": "424242",
      "funding": "credit",
      "fingerprint": "abc123xyz"
    }
  },
  "relationships": [
    {
      "targetEntityId": "person-uuid-123",
      "relationshipType": "owns",
      "strength": 1.0,
      "metadata": {
        "since": "2024-01-15"
      }
    }
  ],
  "riskScore": 15,
  "riskFactors": [
    {
      "type": "high_velocity",
      "severity": "low",
      "description": "Multiple transactions in short timeframe"
    }
  ],
  "createdAt": "2024-01-15T10:00:00.000Z",
  "updatedAt": "2024-12-23T10:00:00.000Z"
}
```

### Bank Account Response

```json theme={null}
{
  "success": true,
  "id": "payment-method-uuid-456",
  "entityType": "payment_method",
  "entityData": {
    "paymentMethod": {
      "type": "bank_account",
      "accountNumber": "12345-6",
      "accountType": "checking",
      "bank": "Banco do Brasil",
      "currency": "BRL",
      "routingNumber": "001",
      "holderName": "John Doe"
    }
  },
  "relationships": [
    {
      "targetEntityId": "person-uuid-123",
      "relationshipType": "owns",
      "strength": 1.0
    }
  ],
  "riskScore": 5,
  "riskFactors": [],
  "createdAt": "2024-01-15T10:00:00.000Z",
  "updatedAt": "2024-12-23T10:00:00.000Z"
}
```

## Use Cases

### Get Payment Method with Owner Details

```javascript theme={null}
async function getPaymentMethodWithOwner(paymentMethodId) {
  // Get payment method
  const pmResponse = await fetch(
    `http://api.gu1.ai/entities/${paymentMethodId}`,
    {
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY'
      }
    }
  );

  const paymentMethod = await pmResponse.json();

  // Get owner (first relationship)
  const ownerRelationship = paymentMethod.relationships.find(
    r => r.relationshipType === 'owns'
  );

  if (ownerRelationship) {
    const ownerResponse = await fetch(
      `http://api.gu1.ai/entities/${ownerRelationship.targetEntityId}`,
      {
        headers: {
          'Authorization': 'Bearer YOUR_API_KEY'
        }
      }
    );

    const owner = await ownerResponse.json();

    return {
      paymentMethod,
      owner
    };
  }

  return { paymentMethod };
}
```

### Check Payment Method Transaction History

```javascript theme={null}
async function getPaymentMethodTransactions(paymentMethodId) {
  // Get all transactions linked to this payment method
  const response = await fetch(
    `http://api.gu1.ai/entities?entityType=transaction&relationshipWith=${paymentMethodId}`,
    {
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY'
      }
    }
  );

  const { entities } = await response.json();

  return entities;
}
```

## Error Responses

### 404 Not Found

```json theme={null}
{
  "error": "Entity not found",
  "entityId": "payment-method-uuid-123"
}
```

### 401 Unauthorized

```json theme={null}
{
  "error": "Invalid or missing API key"
}
```

## See Also

* [Create Payment Method](/en/api-reference/payment-methods/create)
* [Update Payment Method](/en/api-reference/payment-methods/update)
* [List Payment Methods](/en/api-reference/payment-methods/list)
* [Analyze Payment Method](/en/api-reference/entities/analyze)
