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

# Activate Wallet

> Activate a new wallet for an agent

<Note>
  **SDK Alternative**: Use `agent.activate(options)` for a simpler TypeScript interface. [See SDK docs](/sdk-reference/agent/lifecycle)
</Note>

## Description

Activates a new wallet for an agent. This endpoint must be called after the user has deposited funds to their smart account.

## Request Body

<ParamField body="wallet" type="string" required>
  The smart account wallet address
</ParamField>

<ParamField body="eoa" type="string" required>
  The user's externally owned account (origin wallet)
</ParamField>

<ParamField body="initial_token" type="string" required>
  The token address that was deposited (e.g., USDC)
</ParamField>

<ParamField body="selected_protocols" type="string[]" required>
  List of protocol names to use for optimization
</ParamField>

<ParamField body="tx_hash" type="string">
  Transaction hash of the initial deposit (recommended)
</ParamField>

<ParamField body="constraints" type="array">
  Optional constraints for the agent

  **Constraint types:**

  * `min_protocols` - Minimum number of protocols to use
  * `max_allocation_amount_per_protocol` - Maximum amount per protocol
  * `exclude_protocol` - Protocols to exclude
</ParamField>

## Example Request

```bash theme={null}
curl -X POST "https://partners-backend-1038109371738.europe-west1.run.app/api/v1/8453/wallets" \
  -H "Content-Type: application/json" \
  -H "X-Partner-API-Key: your-api-key" \
  -H "X-Partner-Name: your-partner-name" \
  -d '{
    "wallet": "0x1234567890abcdef1234567890abcdef12345678",
    "eoa": "0xabcdefabcdefabcdefabcdefabcdefabcdefabcd",
    "initial_token": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "selected_protocols": ["aave", "compound", "moonwell"],
    "tx_hash": "0x...",
    "constraints": [
      {
        "kind": "min_protocols",
        "params": { "min_protocols": 2 }
      }
    ]
  }'
```

## Response

<ResponseField name="message" type="string">
  Confirmation message
</ResponseField>

<ResponseField name="wallet" type="string">
  The wallet address that was activated
</ResponseField>

```json Response Example theme={null}
{
  "message": "Agent activated successfully",
  "wallet": "0x1234567890abcdef1234567890abcdef12345678"
}
```

## Error Responses

| Status | Description                        |
| ------ | ---------------------------------- |
| `400`  | Invalid input data                 |
| `403`  | Access denied or deposit too large |
| `422`  | Validation error                   |
| `500`  | Internal server error              |

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://partners-backend-1038109371738.europe-west1.run.app/api/v1/8453/wallets" \
    -H "Content-Type: application/json" \
    -H "X-Partner-API-Key: your-api-key" \
    -H "X-Partner-Name: your-partner-name" \
    -d '{
      "wallet": "0x1234567890abcdef1234567890abcdef12345678",
      "eoa": "0xabcdefabcdefabcdefabcdefabcdefabcdefabcd",
      "initial_token": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "selected_protocols": ["aave", "compound", "moonwell"]
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://partners-backend-1038109371738.europe-west1.run.app/api/v1/8453/wallets',
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        'X-Partner-API-Key': 'your-api-key',
        'X-Partner-Name': 'your-partner-name',
      },
      body: JSON.stringify({
        wallet: '0x1234567890abcdef1234567890abcdef12345678',
        eoa: '0xabcdefabcdefabcdefabcdefabcdefabcdefabcd',
        initial_token: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
        selected_protocols: ['aave', 'compound', 'moonwell'],
      }),
    }
  );

  const data = await response.json();
  ```

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

  response = requests.post(
      'https://partners-backend-1038109371738.europe-west1.run.app/api/v1/8453/wallets',
      headers={
          'X-Partner-API-Key': 'your-api-key',
          'X-Partner-Name': 'your-partner-name',
      },
      json={
          'wallet': '0x1234567890abcdef1234567890abcdef12345678',
          'eoa': '0xabcdefabcdefabcdefabcdefabcdefabcdefabcd',
          'initial_token': '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
          'selected_protocols': ['aave', 'compound', 'moonwell'],
      }
  )

  data = response.json()
  ```
</RequestExample>

<ResponseExample>
  ```json 201 Created theme={null}
  {
    "message": "Agent activated successfully",
    "wallet": "0x1234567890abcdef1234567890abcdef12345678"
  }
  ```

  ```json 400 Bad Request theme={null}
  {
    "detail": "Invalid input data"
  }
  ```

  ```json 403 Forbidden theme={null}
  {
    "detail": "Access denied or deposit is too large"
  }
  ```
</ResponseExample>
