Create NFT API
This API is under construction
The Create API endpoint is available for partners who want to submit utility data to Threshr for tracking and dissemination.
Users submit data over an https POST message in json format.
Request
URL
https://threshr.co/api-gateway/create (opens in a new tab)
Parameters
No parameters are used, instead data is sent.
Headers
One header is required to supply your API key:
Authorization: Bearer
And one header is required to supply your data:
Content-Type: application/json
Sample Request with Curl
Here is a full sample request that would create an NFT with two perks:
curl -X POST https://threshr.co/api-gateway/create -H "Authorization: Bearer <API KEY>" -H 'Content-Type: application/json' -d '{"nftData":{"CollectionDescription":"Test collection description","ContractAddress":"","ContractChain":"ETH","Discord":"https://discord.gg/threshr","ImagePic":"https://lh3.googleusercontent.com/VMG3VFncJG-pyqsRAwQznZGqYDw4RkPjJnJNJwrDERFhD4pWLh82q66JJ8Qh0vCPoovjoyigJwLqfFpa5tMAVV5ASIiR5nF1XkQFpec=s0","MarketPlace":"OpenSea","MarketPlaceLink":"YES!","ReleaseStatus":"Upcoming","Title":"Threshr Test","Twitter":"https://twitter.com/threshr","Website":"https://threshr.co","floorPrice":"notset","openseaSlug":""},"perkData":[{"Date":{"dt":{"nanoseconds":0,"seconds":1683828900},"timeSet":true},"Location":{"GeoPoint":{"_lat":39.739336364703384,"_long":-104.98483657836914},"address":"200 E Colfax Ave, Denver, CO 80203, USA","latitude":39.739336364703384,"longitude":-104.98483657836914,"placeId":"ChIJGclBlCp5bIcRjwqRDQIXohI"},"LongDescription":"This is a longer description of Perk Uno. Perhaps it has some merch?","OneTime":true,"ShortDescription":"Perk Uno","Site":"https://threshr.co/perkUno","Status":"Upcoming","Tags":["Events","Gaming"],"ThreshrNFTId":"","TokensRequired":1},{"Date":"","Location":{"GeoPoint":{"_lat":39.74602082152364,"_long":-104.98763924865723},"address":"","latitude":39.74602082152364,"longitude":-104.98763924865723,"placeId":""},"LongDescription":"Here is a longer description of Perk Dos. An event of some kind?","OneTime":false,"ShortDescription":"Perk Dos","Site":"https://threshr.co/perkDos","Status":"Past","Tags":["Merch","Events","Voting","Apparel","Sports","eSports"],"ThreshrNFTId":"","TokensRequired":10}]}'
Data
Data should be supplied in JSON format.
To create or edit data related to an overall NFT collection, data should have an nftData
field that complies with the schema here.
To create or edit data related to single or multiple Perks (i.e. to describe utility), data should have a perkData
field as an array of objects that comply with the schema here.
Sample Data
Sample Javascript data object
{
"nftData": {
"CollectionDescription": "Test collection description",
"ContractAddress": "",
"ContractChain": "ETH",
"Discord": "https://discord.gg/threshr",
"ImagePic": "https://lh3.googleusercontent.com/VMG3VFncJG-pyqsRAwQznZGqYDw4RkPjJnJNJwrDERFhD4pWLh82q66JJ8Qh0vCPoovjoyigJwLqfFpa5tMAVV5ASIiR5nF1XkQFpec=s0",
"MarketPlace": "OpenSea",
"MarketPlaceLink": "YES!",
"ReleaseStatus": "Upcoming",
"Title": "Threshr Test",
"Twitter": "https://twitter.com/threshr",
"Website": "https://threshr.co",
},
"perkData": [
{
"Date": {
"dt": {
"nanoseconds": 0,
"seconds": 1683828900
},
"timeSet": true
},
"Location": {
"GeoPoint": {
"_lat": 39.739336364703384,
"_long": -104.98483657836914
},
"address": "200 E Colfax Ave, Denver, CO 80203, USA",
"latitude": 39.739336364703384,
"longitude": -104.98483657836914,
"placeId": "ChIJGclBlCp5bIcRjwqRDQIXohI"
},
"LongDescription": "This is a longer description of Perk Uno. Perhaps it has some merch?",
"OneTime": true,
"ShortDescription": "Perk Uno",
"Site": "https://threshr.co/perkUno",
"Status": "Upcoming",
"Tags": [
"Events",
"Gaming"
],
"ThreshrNFTId": "",
"TokensRequired": 1
},
{
"Date": "",
"Location": {
"GeoPoint": {
"_lat": 39.74602082152364,
"_long": -104.98763924865723
},
"latitude": 39.74602082152364,
"longitude": -104.98763924865723,
},
"LongDescription": "Here is a longer description of Perk Dos. An event of some kind?",
"OneTime": false,
"ShortDescription": "Perk Dos",
"Site": "https://threshr.co/perkDos",
"Status": "Past",
"Tags": [
"Merch",
"Events",
"Voting",
"Apparel",
"Sports",
"eSports"
],
"ThreshrNFTId": "",
"TokensRequired": 10
},
]
}
Creating vs Editing
Creating
Creating an NFT Collection
By leaving the ThreshrNFTId
field blank in the nftData
object, the API will create a new NFT Collection.
Creating Perks With NFT Collection
Perks can be created at the same time as the NFT collection by including a perkData
object. The Perks in this case do not need a ThreshrNFTId
nor do they require ThreshrPerkId
s themselves. These will be added.
Creating Perks Without Changing or Adding NFT Data
Perks can be created and added to an existing collection by including the appropriate ThreshrNFTId
field in the perkData
object's individual perks.
Editing
When editing either an NFT Collection or a Perk, it is essential to include ALL information that should be in the updated object. Leaving out fields in the nftData
or perkData
objects will result in those fields' values being unassigned.
Editing NFT Collection Data
To change information about an NFT, such as its collection description, fill out the nftData
object and include the assigned ThreshrNFTId
for the collection.
Editing Perk Data
To change information about a Perk, for instance to update the date of a merch drop, fill out the perkData
object and include BOTH the assigned ThreshrNFTId
and ThreshrPerkId
for the Perk.
Response
This API is under construction
Since the API is currently under construction, if the request is successful you will receive an HTTP 200 Status Code.
The response body will be an echo of your supplied data along with the following additional key/value:
{
"GatewayStatus":"Hello, the Threshr NFT Creation gateway is still under construction. You have sent good data to the right place, we'll have this connected soon!"
}
Errors
Bad Data
Posting bad data to this endpoint will result in an HTTP 400 Status Code.
The body of the response will be JSON with a descriptive error, most likely:
{ "error": "Can't Unmarshal Body" }
Too Many Requests
Surpassing the rate limit for the API will return status code 429 Too Many Requests.
The body of the response will be JSON:
{"error":"Too Many Requests"}
Unauthorized Access
Attempting to create or modify an NFT or Perk with a bad API key will result in an HTTP 401 Status Unauthorized.
The body of the response will be JSON with a descriptive error, such as:
{"error":"Bad API Key"}