Skip to main content

Creating a User Profile

Create a Profile on Your Graph

The first step in most apps on Tapestry is creating composable user identities. This is achieved through profile creation and the findOrCreate endpoint.

Each profile on Tapestry is namespaced to a specific app.

We recommend passing in at minimum a username and a walletAddress in your findOrCreate request. This will create a user profile on your graph and connect it to the user's wallet. The connection between the wallet and profile enables the interoperation of profiles across different apps on Tapestry. Without a wallet address, you will be unable to access features that surface suggested social connections or speed up onboarding through profile imports.

For additional granularity, you can also pass in an id parameter (for example, a uuid). If you do not specify an id, the API will automatically set the id to the same value as the username.

Other Parameters

blockchain refers to the chain the public key is on. If you leave it blank, it will be set to Solana.

execution refers to the methodology with which the onchain transaction will be processed. For more information on the different execution methods, see here. The default execution method is FAST_UNCONFIRMED.

  • FAST_UNCONFIRMED performs the write and returns a 200 before the onchain transaction has landed, while optimistically trying to land the onchain transaction in the background. This is the fastest roundtrip, with average times of under 1s.
  • QUICK_SIGNATURE returns a transaction signature for the onchain transaction, but does not attempt to confirm it. This option is best if you want to use your own confirmation logic.
  • CONFIRMED_AND_PARSED waits for the onchain transaction to be sent and confirmed before returning a 200. This is the slowest execution method, with roundtrip times for 200 responses averaging 15s.
await fetch(
'https://api.usetapestry.dev/v1/profiles/findOrCreate?apiKey=YOUR_API_KEY',
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
walletAddress: 'WALLET_ADDRESS_HERE',
username: 'username_here',
id: 'arbitrary_uuid_or_leave_blank'
execution: 'FAST_UNCONFIRMED',
}),
},
)

If you want to store additional information, you can pass in any data as JSON key-value pairs in the properties field.

Once the code executes, you can check the status in the visualizer at https://app.usetapestry.dev/visualize or with a GET request to the profile endpoint.

Read Profile

To read this information back, use the following. Put the profile's id in the GET request:

await fetch(
'https://api.usetapestry.dev/v1/profiles/__ID__?apiKey=YOUR_API_KEY',
)

This will return everything in the profile node you just created. Here's an example response:

{
"profile": [
{
"elementId": "4:3549be5c-1f5e-45ad-a322-0597a33d5ae8:25935",
"labels": [
"profile",
"your_namespace"
],
"properties": {
"namespace": "your_namespace",
"id": "user_profile",
"blockchain": "Solana",
"username": "user_profile"
}
}
],
"socialCounts": {
"followers": [
0
],
"following": [
0
]
}
}

Try creating a second profile. In the next guide, we'll walk through how to connect them on your graph.