Skip to main content

Get collection contract functions

Use the collections/{collection_id}/functions endpoint to get multiple functions or a specific function for a collection contract.

info

The collection contract must have functions_enabled set to True for the endpoint to be accessible. You can set this by editing the collection.

Get multiple contract functions

Issue a GET request to the collections/{collection_id}/functions endpoint to get all functions for a collection contract.

GET https://admin-api.phosphor.xyz/v1/collections/{collection_id}/functions

This is a paginated endpoint that returns results up to a certain limit.

  • Specify a cursor from the previous response to return the next batch of results from the offset.
  • Specify an order_direction of ASC or DESC to sort results in an ascending or descending order.
GET https://admin-api.phosphor.xyz/v1/collections/{collection_id}/functions?limit=1
Example response (abbreviated)
{
"cursor": "c3RfM2I1OGFjMmYtYzViNy00MThlLWIxZDgtZjU2YmI1ZjE2Zjlk",
"has_more": false,
"results": [
{
"abi": {
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "adminMint",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
"enabled": true,
"id": "004a84cb"
}
],
"total_results": 1
}
  • cursor indicates an offset from which the next batch of results begins.
  • has_more returns true if there are more results than already displayed.
  • results returns an array of contract functions from the search.
  • total_results returns the total number of results from the response.

Get a specific contract function by ID

Issue a GET request to the collections/{collection_id}/functions endpoint with a function_id to get details on a specific function.

GET https://admin-api.phosphor.xyz/v1/collections/{collection_id}/functions/{function_id}
Example response
{
"abi": {
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "adminMint",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
"enabled": true,
"id": "004a84cb"
}