Skip to content

Others

Add custom user identity

POST https://api.stack.so/api/v1/point-systems/{pointSystemId}/tags

Within a point system, customize the profile picture, display name, and external link out for users on your leaderboard.

example

Python

python
import requests

url = f'https://api.stack.so/api/v1/point-systems/{pointSystemId}/tags'

payload = {
  "walletAddress": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
	"tag": "custom identity",
	"tagData": {
		"identity": "CustomUser123", 
		"pfpUrl": "user image or gif url here",
		"externalUrl": "mywebsite.com/CustomUser123",
	}
	"source": "MyAppStaging",
}
headers = {
  "Content-Type": "application/json",
  "x-api-key": "<API_KEY>"
}

response = requests.request("POST", url, json=payload, headers=headers)

Go

go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

type IdentityTagData struct {
	Identity		string `json:"identity"`
	PfpUrl			string `json:"pfpUrl"`
	ExternalUrl	string `json:"externalUrl"`
}

type Request struct {
	WalletAddress string 					`json:"walletAddress"`
	Tag 					string 					`json:"tag"`
	TagData				IdentityTagData `json:"tagData"`
	Source				string 					`json:"source"`
}

func main() {
	baseURL := fmt.Sprintf("https://api.stack.so/api/v1/point-systems/%s/tags", pointSystemId)
	url, _ := url.Parse(baseURL)

  requestBody := Request{
		WalletAddress: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
		Tag: "custom identity",
		TagData: {
			Identity: "CustomUser123", 
			PfpUrl: "user image or gif url here",
			ExternalUrl: "mywebsite.com/CustomUser123",
		},
		Source: "MyAppStaging",
  }

  jsonBody, _ := json.Marshal(requestBody)
	payload := strings.NewReader(string(jsonBody))

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")
	req.Header.Add("x-api-key", "<API_KEY>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))
}

Create additional point systems

POST https://api.stack.so/api/v1/point-systems/create

For creating additional point systems programatically

Params

NameDescriptionExample
nameName of point system being created
my second point system

cURL

shell
curl --request POST \
  --url https://api.stack.so/api/v1/point-systems/create \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <API_KEY>' \
  --data '{"args:" : {"name":"my second point system"}}'

Python

python
import requests

url = f'https://api.stack.so/api/v1/point-systems/create'

payload = {
  "args": {
		"name": "my second point system",
	}
}
headers = {
  "Content-Type": "application/json",
  "x-api-key": "<API_KEY>"
}

response = requests.request("POST", url, json=payload, headers=headers)

Go

go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

type Args struct {
	Name string `json:"name"`
}

type Request struct {
	args Args `json: "args"`
}

func main() {
	url := "https://api.stack.so/api/v1/point-systems/create"
  requestBody := Request{
		Args: {
      Name: "my second point system",
		}
  }

  jsonBody, _ := json.Marshal(requestBody)
	payload := strings.NewReader(string(jsonBody))

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")
	req.Header.Add("x-api-key", "<API_KEY>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))
}