Custom Development
Getting Started
The DoppelMe API is a REST API: send JSON over HTTPS from your server, in any language. You need a partner id and partner key if you haven't one already. Keep the key on your server.Hello World
Check that your id and key work. The key goes in anAuthorization header, after the id and a colon:
curl https://api.doppelme.com/v2/ping \
-H "Authorization: Bearer YOUR_PARTNER_ID:YOUR_PARTNER_KEY"
If you have problems with access, make sure that your whitelist in your partner area is set up appropriately.
Create an Avatar
One of the first things that you might want to do is create an avatar for your user. Thepartner_user_id
is your own id for the person. Repeating the request is safe: it never makes a second account. The answer has the
avatar's doppelme_key. Store it with your user's details so that you always refer to their avatar.
# create the account and first avatar for your user 1001
curl -X PUT https://api.doppelme.com/v2/users/1001 \
-H "Authorization: Bearer YOUR_PARTNER_ID:YOUR_PARTNER_KEY" \
-H "Content-Type: application/json" \
-d '{"avatar_name": "First Avatar"}'
Update Your Users Avatar
Change part of the avatar, using the key from above. This puts item 109 on the avatar and colours it red. Leave out what you don't want to change. Use item0 to take an item off.
curl -X PATCH https://api.doppelme.com/v2/users/1001/avatars/DOPPELME_KEY \
-H "Authorization: Bearer YOUR_PARTNER_ID:YOUR_PARTNER_KEY" \
-H "Content-Type: application/json" \
-d '{"slots": {"bottom": {"id": 109, "colour": "FF0000"}}}'
Then show the avatar:
<img src="https://www.doppelme.com/DOPPELME_KEY/avatar.png" alt="Avatar">
Find Items
See which items you can offer, in each of the two avatar styles. Addpartner_user_id to mark the ones a
person already owns.
curl "https://api.doppelme.com/v2/catalogue/1101?type=hair&partner_user_id=1001" \
-H "Authorization: Bearer YOUR_PARTNER_ID:YOUR_PARTNER_KEY"
Make Up an Avatar
Give an avatar a made-up look, for example for a bot or a new user. The sameseed always gives the same avatar.
curl -X POST https://api.doppelme.com/v2/users/1001/avatars/DOPPELME_KEY/randomise \
-H "Authorization: Bearer YOUR_PARTNER_ID:YOUR_PARTNER_KEY" \
-H "Content-Type: application/json" \
-d '{"seed": "bot-4821"}'
Let Users Edit Their Own Avatar
You don't have to build an editor. See how to add the avatar editor to your page.Give Coins and Unlock Items
Your account holds a balance of coins, which you buy in the partner area. You can give them to your users, perhaps as an achievement award. People spend coins on items in the editor.# how many coins you have left
curl https://api.doppelme.com/v2/coins -H "Authorization: Bearer YOUR_PARTNER_ID:YOUR_PARTNER_KEY"
# give your user 1001 five coins
curl -X POST https://api.doppelme.com/v2/users/1001/coins -H "Authorization: Bearer YOUR_PARTNER_ID:YOUR_PARTNER_KEY" -H "Content-Type: application/json" -d '{"coins": 5}'
You can also unlock an item, so that a person can wear it without buying it. It costs you what it would cost them, once.
Asking again for an item they already own is safe, and is not charged.
curl -X POST https://api.doppelme.com/v2/users/1001/items -H "Authorization: Bearer YOUR_PARTNER_ID:YOUR_PARTNER_KEY" -H "Content-Type: application/json" -d '{"item_id": 503}'
If you do not have enough coins, nothing is given and the answer is 402 not_enough_coins. Giving coins is not
safe to repeat, so if you do not get an answer, check the person's coins before trying again.

