# Base Account API \[DEPRECATED]

The Base Account API powers [Patch wallets](https://app.patchwallet.com) and controls the [EIP-4337 account abstraction](https://eips.ethereum.org/EIPS/eip-4337) smart contract wallets called, Base Accounts.

Base Accounts are a simple smart contract wallet with the same address on all EVM chains and connected to a user's email, social account, phone, or an app provider. They are centered around the concept of a `user_id` which is a combination of a `provider` and `username`.&#x20;

#### **user\_ids:**

* `twitter:elonmusk`
* `email:your@mom.com`
* `github:torvalds`
* `yourapp:userid123`

### Submit a Transaction

To send a transaction through a Base Account, see the [Base Tx endpoint on Postman](https://www.postman.com/paymagic/workspace/public-patch-wallet-api).

## Send a transaction through a Base Account on the target chain

<mark style="color:green;">`POST`</mark> `https://paymagicapi.com/v1/base/tx`

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer Token |

#### Request Body

| Name                                     | Type         | Description                                                                                                                                      |
| ---------------------------------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| data<mark style="color:red;">\*</mark>   | String Array | The data to pass in for the the transaction. Could be multiple fields for multiple transactions.                                                 |
| value<mark style="color:red;">\*</mark>  | String Array | The amount of native coins to send with the transaction. Could be multiple values for multiple transactions.                                     |
| to<mark style="color:red;">\*</mark>     | String Array | The contract address that the Base Account is calling. Could be multiple address for multiple transactions.                                      |
| chain<mark style="color:red;">\*</mark>  | String       | The ERC-3770 standard name for the target chain                                                                                                  |
| userId<mark style="color:red;">\*</mark> | String       | The userId of the wallet for the transaction                                                                                                     |
| auth<mark style="color:red;">\*</mark>   | String       | The corresponding auth token for the given wallet. The token will vary based on whether the userId is for a Twitter, email, or telephone wallet. |

{% tabs %}
{% tab title="400: Bad Request Invalid request" %}

{% endtab %}

{% tab title="200: OK Successfully submitted onchain" %}

{% endtab %}
{% endtabs %}

```javascript
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer {{access_token}}");
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
  "userId": "email:gesaga3479@kaudat.com",
  "chain": "matic",
  "to": [
    "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"
  ],
  "value": [
    "0x00"
  ],
  "data": [
    "0xa9059cbb000000000000000000000000F2c47a58c1653b2b1E61010a2cE76ec8368C87Ba00000000000000000000000000000000000000000000000000000000000F4240"
  ],
  "auth": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoZW50aWNhdGVkIiwiZXhwIjoxNjc5NDYwODQ2LCJzdWIiOiI4YTFlODg2YS0xNmRjLTRlM2ItODg5MS04MWFiMjk3M2U5NjIiLCJlbWFpbCI6Imdlc2FnYTM0NzlAa2F1ZGF0LmNvbSIsInBob25lIjoiIiwiYXBwX21ldGFkYXRhIjp7InByb3ZpZGVyIjoiZW1haWwiLCJwcm92aWRlcnMiOlsiZW1haWwiXX0sInVzZXJfbWV0YWRhdGEiOnt9LCJyb2xlIjoiYXV0aGVudGljYXRlZCIsImFhbCI6ImFhbDEiLCJhbXIiOlt7Im1ldGhvZCI6Im90cCIsInRpbWVzdGFtcCI6MTY3OTQ1NzI0Nn1dLCJzZXNzaW9uX2lkIjoiMGRhMmQ4YmUtY2FiYS00MGRhLWE5ZTctOTliMjNlZmE4ZWExIn0.lfjj6YbJoCRSXRgW9vPg6Un0ck0NiBH6S97_gXUGKUE"
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("{{paymagicBaseUrl}}/base/tx", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
```

### Sign a Message

*Coming Soon*
