|
| 1 | +import { Callout } from "@doc"; |
| 2 | +import { createMetadata, ArticleIconCard } from "@doc"; |
| 3 | + |
| 4 | +export const metadata = createMetadata({ |
| 5 | + image: { |
| 6 | + title: "Get Users", |
| 7 | + icon: "wallets", |
| 8 | + }, |
| 9 | + title: "Get Users | thirdweb", |
| 10 | + description: "Learn how to fetch in-app wallet users for your application.", |
| 11 | +}); |
| 12 | + |
| 13 | +# Get Users |
| 14 | + |
| 15 | +Once you have users connecting to your app through in-app wallets, you can fetch all users through our REST API: |
| 16 | +``` |
| 17 | +https://in-app-wallet.thirdweb.com/api/v1/users |
| 18 | +``` |
| 19 | + |
| 20 | +## Headers |
| 21 | + |
| 22 | +You need to include the following headers: |
| 23 | + |
| 24 | +- `Content-Type`: Must be set to `application/json` |
| 25 | +- `x-secret-key`: Your secret key for authentication |
| 26 | +- `x-ecosystem-id` (optional): Your ecosystem ID |
| 27 | +- `x-ecosystem-partner-id` (optional): Your ecosystem partner ID |
| 28 | + |
| 29 | +## Example curl Command |
| 30 | + |
| 31 | +Here's an example curl command to pregenerate a thirdweb wallet for the user `[email protected]`: |
| 32 | + |
| 33 | +```bash |
| 34 | +curl -X POST 'https://in-app-wallet.thirdweb.com/api/v1/users?offset=200&limit=100' \ |
| 35 | + -H 'x-secret-key: YOUR_SECRET_KEY' \ |
| 36 | + -H 'Content-Type: application/json' |
| 37 | +``` |
| 38 | + |
| 39 | +Limit defaults to 100 users per request. |
| 40 | + |
| 41 | +<Callout variant='info' title='Getting ecosystem users'> |
| 42 | +For ecosystem wallets, the secret key have to be from the same account as the ecosystem owner. |
| 43 | +</Callout> |
| 44 | + |
| 45 | + |
| 46 | +## Response Format |
| 47 | + |
| 48 | +A successful API call returns an array of user objects in the following format: |
| 49 | + |
| 50 | +```json |
| 51 | +[ |
| 52 | + { |
| 53 | + "userId": "9841a5de-b4a6-44b3-ad14-c4b8745782ca", |
| 54 | + "walletAddress": "0x933F5BC72634c55b3643A6Aa0cD5b65ca4915d39", |
| 55 | + "createdAt": "2024-11-05T00:55:25.142Z", |
| 56 | + "authProvider": "google", |
| 57 | + "authDetails": { |
| 58 | + "id": "107302390467834615186", |
| 59 | + "name": "Richard Hendricks", |
| 60 | + "type": "google", |
| 61 | + |
| 62 | + "picture": "https://lh3.googleusercontent.com/a/ACg8ocKC1D6ezzzaZxxUk4qtK_HCwVwpNamVopazXwklGBwuuHeSf_c=s96-c", |
| 63 | + "givenName": "Richard", |
| 64 | + "emailVerified": true |
| 65 | + }, |
| 66 | + |
| 67 | + } |
| 68 | +] |
| 69 | +``` |
| 70 | + |
0 commit comments