Skip to content

Commit 4f18cf1

Browse files
[Portal] Fix HTTP method in wallet users API example from POST to GET
1 parent 692c25e commit 4f18cf1

File tree

1 file changed

+107
-3
lines changed
  • apps/portal/src/app/connect/wallet/get-users

1 file changed

+107
-3
lines changed

apps/portal/src/app/connect/wallet/get-users/page.mdx

Lines changed: 107 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,112 @@ export const metadata = createMetadata({
1010
description: "Learn how to fetch in-app wallet users for your application.",
1111
});
1212

13-
# Get Users
13+
# Get a Single Users
14+
15+
From the backend, you are able to get the details of any user within your in app or ecosystem wallet.
16+
17+
To get the user details, you can make a `GET` request to the following endpoint:
18+
19+
```
20+
https://in-app-wallet.thirdweb.com/api/2023-11-30/embedded-wallet/user-details
21+
```
22+
23+
### Query Parameters
24+
25+
You can specify the query parameter `queryBy` to query by different user identifiers:
26+
27+
- `queryBy`: The parameter to query by. Can be one of `walletAddress`, `email`, `phone`, `externalWalletAddress`, or `id`.
28+
29+
You can then specify the value to query by, matching the queryBy parameter:
30+
31+
- `walletAddress`: The user's wallet address that thirdweb has generated for them
32+
- `email`: The user's email address
33+
- `phone`: The user's phone number
34+
- `externalWalletAddress`: The user's wallet address that used to login via SIWE
35+
- `id`: The user's ID (for custom auth)
36+
37+
### Authentication
38+
39+
You need to include your ThirdWeb Client Secret in the Authorization header.
40+
41+
If you are an ecosystem owner, you have to include the `x-ecosystem-id` header and optionally the `x-ecosystem-partner-id` header if the ecosystem is set to partners only.
42+
43+
### Example curl Command
44+
45+
Here's an example curl command to fetch user details by email:
46+
47+
```bash
48+
curl -X GET 'https://in-app-wallet.thirdweb.com/api/2023-11-30/embedded-wallet/user-details?queryBy=email&[email protected]' \
49+
-H 'x-secret-key: YOUR_THIRD_WEB_CLIENT_SECRET'
50+
```
51+
52+
Here's an example curl command to fetch user details by address:
53+
54+
```bash
55+
curl -X GET 'https://in-app-wallet.thirdweb.com/api/2023-11-30/embedded-wallet/user-details?queryBy=walletAddress&walletAddress=0x123456789abcdef' \
56+
-H 'x-secret-key: YOUR_THIRD_WEB_CLIENT_SECRET'
57+
```
58+
59+
Here's an example curl command to fetch the user details for an ecosystem owner:
60+
61+
```bash
62+
curl -X GET 'https://in-app-wallet.thirdweb.com/api/2023-11-30/embedded-wallet/user-details?queryBy=walletAddress&walletAddress=0x123456789abcdef' \
63+
-H 'x-secret-key: YOUR_THIRD_WEB_CLIENT_SECRET' \
64+
-H 'x-ecosystem-id: ecosystem.YOUR_ECOSYSTEM_ID' \
65+
-H 'x-ecosystem-partner-id: YOUR_PARTNER_ID'
66+
```
67+
68+
In both examples, replace `YOUR_THIRD_WEB_CLIENT_SECRET` with your actual ThirdWeb Client Secret.
69+
70+
Replace `YOUR_ECOSYSTEM_ID` and `YOUR_PARTNER_ID` with your actual ecosystem ID and partner ID respectively. The partner ID can be one you set up for yourself as the ecosystem owner.
71+
72+
### Response Format
73+
74+
The API returns a JSON array with the following structure for each user:
75+
76+
```json
77+
[
78+
{
79+
"userId": "string",
80+
"walletAddress": "string",
81+
"email": "string (optional)",
82+
"phone": "string (optional)",
83+
"createdAt": "string",
84+
"linkedAccounts": [
85+
{
86+
"type": "string",
87+
"details": {
88+
"phone": "string",
89+
// or
90+
"email": "string",
91+
// or
92+
"address": "string",
93+
// or
94+
"id": "string",
95+
// Additional key-value pairs may be present
96+
}
97+
}
98+
]
99+
}
100+
]
101+
```
102+
103+
Note: The `details` object in `linkedAccounts` will contain different fields based on the account type. See the [list of Strategies](#list-of-strategies) above for more information.
104+
105+
Remember to handle the response appropriately in your chosen programming language, including error cases and parsing the JSON response.
106+
107+
### Convenience Methods
108+
109+
If you are using the thirdweb SDK, you can use the `getUser` method to retrieve user details.
110+
111+
<ArticleIconCard
112+
title="getUser"
113+
icon={TypeScriptIcon}
114+
description="Get user details from your backend for thirdweb wallets in TypeScript"
115+
href="/references/typescript/v5/getUser"
116+
/>
117+
118+
# Get All Users
14119

15120
Once you have users connecting to your app through in-app wallets, you can fetch all users through our REST API:
16121
```
@@ -31,7 +136,7 @@ You need to include the following headers:
31136
Here's an example curl command to pregenerate a thirdweb wallet for the user `[email protected]`:
32137

33138
```bash
34-
curl -X POST 'https://in-app-wallet.thirdweb.com/api/v1/users?offset=200&limit=100' \
139+
curl -X GET 'https://in-app-wallet.thirdweb.com/api/v1/users?offset=200&limit=100' \
35140
-H 'x-secret-key: YOUR_SECRET_KEY' \
36141
-H 'Content-Type: application/json'
37142
```
@@ -67,4 +172,3 @@ A successful API call returns an array of user objects in the following format:
67172
}
68173
]
69174
```
70-

0 commit comments

Comments
 (0)