NPCs
NPCs are merchant or trader characters from whom you can buy, sell or trade items. Some are static, while others appear dynamically thanks to the event system.
List of NPCs
You can use this GET request to view the list of all existing NPCs.
curl --location --request GET 'https://api.artifactsmmo.com/npcs/details' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json'
var myHeaders = new Headers();
myHeaders.append("Accept", "application/json");
myHeaders.append("Content-Type", "application/json");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.artifactsmmo.com/npcs/details", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
View the API Reference (opens in a new tab)
Buying/selling/trading items
When viewing the items on an NPC, if the currency
field shows anything other than gold
, it will display the code of the item you need to trade to the NPC.
You can use this GET request to view the list of items that npc sells/buys/trades.
curl --request GET \
--url https://api.artifactsmmo.com/npcs/items/{npc_code} \
--header 'Accept: application/json'
const url = 'https://api.artifactsmmo.com/npcs/items/{npc_code}';
const options = {method: 'GET', headers: {Accept: 'application/json'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
View the API Reference (opens in a new tab)
Actions
To buy or sell an item, you must be on a map with an NPC. To learn more about the map, click here. (opens in a new tab)
You can use this POST request to buy an item.
curl --request POST \
--url https://api.artifactsmmo.com/my/{name}/action/npc/buy \
--header 'Accept: application/json' \
--header 'Authorization: Bearer INSERT_YOUR_TOKEN_HERE' \
--header 'Content-Type: application/json' \
--data '{
"code": "string",
"quantity": 1
}'
const url = 'https://api.artifactsmmo.com/my/{name}/action/npc/buy';
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
Authorization: 'Bearer INSERT_YOUR_TOKEN_HERE'
},
body: '{"code":"string","quantity":1}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
View the API Reference (opens in a new tab)
You can use this POST request to sell an item.
curl --request POST \
--url https://api.artifactsmmo.com/my/{name}/action/npc/sell \
--header 'Accept: application/json' \
--header 'Authorization: Bearer INSERT_YOUR_TOKEN_HERE' \
--header 'Content-Type: application/json' \
--data '{
"code": "string",
"quantity": 1
}'
const url = 'https://api.artifactsmmo.com/my/{name}/action/npc/sell';
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
Authorization: 'Bearer INSERT_YOUR_TOKEN_HERE'
},
body: '{"code":"string","quantity":1}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}