Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions apps/portal/src/app/connect/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ export const sidebar: SideBar = {
name: "Sign-In Methods",
href: `${walletSlug}/sign-in-methods/configure`,
},
{
name: "Fetch Users",
href: `${walletSlug}/get-users`,
},
{
name: "Pregenerate Wallets",
href: `${walletSlug}/pregenerate-wallets`,
Expand Down
70 changes: 70 additions & 0 deletions apps/portal/src/app/connect/wallet/get-users/page.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { Callout } from "@doc";
import { createMetadata, ArticleIconCard } from "@doc";

export const metadata = createMetadata({
image: {
title: "Get Users",
icon: "wallets",
},
title: "Get Users | thirdweb",
description: "Learn how to fetch in-app wallet users for your application.",
});

# Get Users

Once you have users connecting to your app through in-app wallets, you can fetch all users through our REST API:
```
https://in-app-wallet.thirdweb.com/api/v1/users
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, we should probably add how to get a single user here

```

## Headers

You need to include the following headers:

- `Content-Type`: Must be set to `application/json`
- `x-secret-key`: Your secret key for authentication
- `x-ecosystem-id` (optional): Your ecosystem ID
- `x-ecosystem-partner-id` (optional): Your ecosystem partner ID

## Example curl Command

Here's an example curl command to pregenerate a thirdweb wallet for the user `[email protected]`:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example description refers to pregenerating wallets, but this endpoint is for fetching users. The text should be updated to: "Here's an example curl command to fetch users:"

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.


```bash
curl -X POST 'https://in-app-wallet.thirdweb.com/api/v1/users?offset=200&limit=100' \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The HTTP method should be GET rather than POST since this endpoint is retrieving data rather than creating/modifying resources. The curl command should be:

curl -X GET 'https://in-app-wallet.thirdweb.com/api/v1/users?offset=200&limit=100'

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.

-H 'x-secret-key: YOUR_SECRET_KEY' \
-H 'Content-Type: application/json'
```

Limit defaults to 100 users per request.

<Callout variant='info' title='Getting ecosystem users'>
For ecosystem wallets, the secret key have to be from the same account as the ecosystem owner.
</Callout>


## Response Format

A successful API call returns an array of user objects in the following format:

```json
[
{
"userId": "9841a5de-b4a6-44b3-ad14-c4b8745782ca",
"walletAddress": "0x933F5BC72634c55b3643A6Aa0cD5b65ca4915d39",
"createdAt": "2024-11-05T00:55:25.142Z",
"authProvider": "google",
"authDetails": {
"id": "107302390467834615186",
"name": "Richard Hendricks",
"type": "google",
"email": "[email protected]",
"picture": "https://lh3.googleusercontent.com/a/ACg8ocKC1D6ezzzaZxxUk4qtK_HCwVwpNamVopazXwklGBwuuHeSf_c=s96-c",
"givenName": "Richard",
"emailVerified": true
},
"email": "[email protected]",
}
]
```

Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ You need to include the following headers:
Here's an example curl command to pregenerate a thirdweb wallet for the user `[email protected]`:

```bash
curl -X POST 'https://embedded-wallet.thirdweb.com/api/v1/pregenerate' \
curl -X POST 'https://in-app-wallet.thirdweb.com/api/v1/pregenerate' \
-H 'x-ecosystem-id: ecosystem.example-eco-123' \
-H 'x-ecosystem-partner-id: 1415d24e-c7b0-4fce-846e-740841ef2c32' \
-H 'x-secret-key: 9f8e7d6c5b4a3f2e1d0c9b8a7ffge434b2a1f0e9d8c7b6a5f4e3d2c1b0a9f8e7' \
Expand Down Expand Up @@ -127,4 +127,4 @@ Pre-generating is independent and doesn't change the user's experience.

Your users can continue to login as per usual. When they do, they will be assigned the pregenerated wallet.

For more information on signing in, see [Sign In](/connect/wallet/sign-in-methods/configure).
For more information on signing in, see [Sign In](/connect/wallet/sign-in-methods/configure).
Loading