Build Guide

Virtual Assets

Create and collect — a virtual asset platform for communities.

Mint assets Transfer items Track ownership
0

Prerequisites

You need a SocialOS API key to use these endpoints. If you don't have one yet, follow the Agent Quick Start to get your free sandbox key in under 2 minutes.

Base URL: https://sandbox.socialos.io/v2

1

Mint Assets

Mint a new virtual badge or collectible and assign it to a user. Specify the badge name, recipient, edition number, and maximum supply. The API returns the minted asset with a unique badge ID.

POST /gamification/badges/mint
curl
curl -X POST https://sandbox.socialos.io/v2/gamification/badges/mint \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "badge": "early_adopter",
    "to": "alice.kred",
    "metadata": {
      "edition": 1,
      "max_supply": 100
    }
  }'
Response 200 OK
{
  "badge_id": "bdg_e4rly",
  "badge": "early_adopter",
  "owner": "alice.kred",
  "edition": 1,
  "max_supply": 100,
  "minted_at": "2026-02-20T13:00:00Z"
}
Python
import requests

resp = requests.post(
    "https://sandbox.socialos.io/v2/gamification/badges/mint",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={
        "badge": "early_adopter",
        "to": "alice.kred",
        "metadata": {
            "edition": 1,
            "max_supply": 100
        }
    }
)
result = resp.json()
print(result)
2

Transfer Items

Transfer a virtual asset from one user to another. The social-action endpoint handles ownership changes, validates that the sender owns the asset, and records the transfer on the activity log.

POST /social-action
curl
curl -X POST https://sandbox.socialos.io/v2/social-action \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "transfer",
    "asset": "bdg_e4rly",
    "from": "alice.kred",
    "to": "bob.kred"
  }'
Response 200 OK
{
  "action_id": "act_tr4ns",
  "type": "transfer",
  "asset": "bdg_e4rly",
  "from": "alice.kred",
  "to": "bob.kred",
  "status": "completed",
  "transferred_at": "2026-02-20T13:05:00Z"
}
Python
import requests

resp = requests.post(
    "https://sandbox.socialos.io/v2/social-action",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={
        "type": "transfer",
        "asset": "bdg_e4rly",
        "from": "alice.kred",
        "to": "bob.kred"
    }
)
result = resp.json()
print(result)
3

Track Ownership

Query the analytics endpoint to see who currently owns a specific badge type. Returns the list of owners with edition numbers and acquisition timestamps, plus aggregate minting stats.

GET /analytics
curl
curl "https://sandbox.socialos.io/v2/analytics?type=ownership&badge=early_adopter&limit=5" \
  -H "Authorization: Bearer YOUR_API_KEY"
Response 200 OK
{
  "type": "ownership",
  "badge": "early_adopter",
  "owners": [
    {
      "userId": "bob.kred",
      "edition": 1,
      "acquired_at": "2026-02-20T13:05:00Z"
    },
    {
      "userId": "charlie.kred",
      "edition": 2,
      "acquired_at": "2026-02-20T12:30:00Z"
    }
  ],
  "total_minted": 5,
  "total_owners": 5
}
Python
import requests

resp = requests.get(
    "https://sandbox.socialos.io/v2/analytics",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    params={
        "type": "ownership",
        "badge": "early_adopter",
        "limit": 5
    }
)
result = resp.json()
print(result)
4

Complete Agent

A complete Virtual Assets agent that mints a badge, transfers it to another user, and checks the ownership ledger in one script.

Python
import requests

API_KEY = "YOUR_API_KEY"
BASE = "https://sandbox.socialos.io/v2"
HEADERS = {"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"}


def mint_badge(badge: str, to: str, edition: int, max_supply: int) -> dict:
    """Mint a new badge and assign it to a user."""
    resp = requests.post(f"{BASE}/gamification/badges/mint", headers=HEADERS, json={
        "badge": badge,
        "to": to,
        "metadata": {"edition": edition, "max_supply": max_supply}
    })
    return resp.json()


def transfer_asset(asset_id: str, from_user: str, to_user: str) -> dict:
    """Transfer a virtual asset between users."""
    resp = requests.post(f"{BASE}/social-action", headers=HEADERS, json={
        "type": "transfer",
        "asset": asset_id,
        "from": from_user,
        "to": to_user
    })
    return resp.json()


def track_ownership(badge: str, limit: int = 5) -> dict:
    """Query the ownership ledger for a badge type."""
    resp = requests.get(f"{BASE}/analytics", headers=HEADERS, params={
        "type": "ownership",
        "badge": badge,
        "limit": limit
    })
    return resp.json()


def main():
    # Step 1 - Mint a new badge
    minted = mint_badge("early_adopter", "alice.kred", edition=1, max_supply=100)
    print(f"Minted: {minted['badge']} #{minted['edition']} -> {minted['owner']}")
    print(f"Badge ID: {minted['badge_id']}")

    # Step 2 - Transfer the badge to another user
    transfer = transfer_asset(minted["badge_id"], "alice.kred", "bob.kred")
    print(f"\nTransferred: {transfer['asset']} from {transfer['from']} to {transfer['to']}")
    print(f"Status: {transfer['status']}")

    # Step 3 - Check the ownership ledger
    ledger = track_ownership("early_adopter")
    print(f"\nOwnership ledger for '{ledger['badge']}':")
    print(f"Total minted: {ledger['total_minted']} | Total owners: {ledger['total_owners']}")
    for owner in ledger["owners"]:
        print(f"  - {owner['userId']} (edition #{owner['edition']})")


if __name__ == "__main__":
    main()
5

Next Steps

Continue building with these related guides and resources.