MycoNom API Documentation
This API allows you to use MycoNom, an AI model that can predict if a given mushroom is edible or not.
Disclaimer
This model is for educational purposes only and should not be used for real-life mushroom classification or any decision-making processes related to the consumption of mushrooms. While the model performs well on the provided dataset, it has not been thoroughly validated for real-world scenarios and may not accurately detect poisonous mushrooms in all conditions. Always consult an expert or use trusted resources when identifying mushrooms.
🚀 Quickstart Using cURL
curl -X POST "https://infinitode.netlify.app/api/v1/myconom" \
-H "Content-Type: application/json" \
-d '{"apiKey": "YOUR_API_KEY", "capShape": "bell", "capSurface": "fibrous", "capColor": "brown", "bruises": "bruises", "odor": "almond", "gillAttachment": "attached", "gillSpacing": "close", "gillSize": "broad", "gillColor": "black", "stalkShape": "enlarging", "stalkRoot": "bulbous", "stalkSurfaceAboveRing": "fibrous", "stalkSurfaceBelowRing": "fibrous", "stalkColorAboveRing": "brown", "stalkColorBelowRing": "brown", "veilType": "partial", "veilColor": "brown", "ringNumber": "none", "ringType": "cobwebby", "sporePrintColor": "black", "population": "abundant", "habitat": "grasses"}'Changelog
1.0 (Latest): Initial commit for API space.
Access
The API can be accessed from
https://infinitode.netlify.app/api/v1/myconomAuthentication
Bearer
This API uses Bearer Token authentication. Include your standard API key in the Authorization header of your request.
You can also use the API with the default GET method, and continue to use the default apiKey or token parameters. When using the authorization bearer, apiKey or token parameters are automatically ignored.
API Token
Alternatively, pass your standard API key as a request parameter instead of a header: as the apiKey field in the JSON body for POST, or as the token query parameter for GET.
You can also use the API with the default GET method.
Endpoint
Predict Mushroom Edibility
Endpoint URL:
HTTP Methods:
PostGet
Request Body
The request body should be a JSON object with the following properties:
apiKey: Your API token.capShape: The cap shape of the mushroom. Available values are: 'bell', 'conical', 'convex', 'flat', 'knobbed', 'sunken'.capSurface: The cap surface of the mushroom. Available values are: 'fibrous', 'grooves', 'scaly', 'smooth'.capColor: The cap color of the mushroom. Available values are: 'brown', 'buff', 'cinnamon', 'gray', 'green', 'pink', 'purple', 'red', 'white', 'yellow'.bruises: If the mushroom has bruises. Available values are: 'bruises', 'no'.odor: The odor of the mushroom. Available values are: 'almond', 'anise', 'creosote', 'fishy', 'foul', 'musty', 'none', 'pungent', 'spicy'.gillAttachment: The gill attachment of the mushroom. Available values are: 'attached', 'descending', 'free', 'notched'.gillSpacing: The gill spacing of the mushroom. Available values are: 'close', 'crowded', 'distant'.gillSize: The gill size of the mushroom. Available values are: 'broad', 'narrow'.gillColor: The color of the mushroom's gills. Available values are: 'black', 'brown', 'buff', 'chocolate', 'gray', 'green', 'orange', 'pink', 'purple', 'red', 'white', 'yellow'.stalkShape: The stalk shape of the mushroom. Available values are: 'enlarging', 'tapering'.stalkRoot: The stalk root of the mushroom. Available values are: 'bulbous', 'club', 'cup', 'equal', 'rhizomorphs', 'rooted', 'missing'.stalkSurfaceAboveRing: The stalk surface above the ring of the mushroom. Available values are: 'fibrous', 'scaly', 'silky', 'smooth'.stalkSurfaceBelowRing: The stalk surface below the ring of the mushroom. Available values are: 'fibrous', 'scaly', 'silky', 'smooth'.stalkColorAboveRing: The stalk color above the ring of the mushroom. Available values are: 'brown', 'buff', 'cinnamon', 'gray', 'orange', 'pink', 'red', 'white', 'yellow'.stalkColorBelowRing: The stalk color below the ring of the mushroom. Available values are: 'brown', 'buff', 'cinnamon', 'gray', 'orange', 'pink', 'red', 'white', 'yellow'.veilType: The veil type of the mushroom. Available values are: 'partial', 'universal'.veilColor: The veil color of the mushroom. Available values are: 'brown', 'orange', 'white', 'yellow'.ringNumber: The number of rings of the mushroom. Available values are: 'none', 'one', 'two'.ringType: The ring type of the mushroom. Available values are: 'cobwebby', 'evanescent', 'flaring', 'large', 'none', 'pendant', 'sheathing', 'zone'.sporePrintColor: The spore print color of the mushroom. Available values are: 'black', 'brown', 'buff', 'chocolate', 'green', 'orange', 'purple', 'white', 'yellow'.population: The population density of the mushroom. Available values are: 'abundant', 'clustered', 'numerous', 'scattered', 'several', 'solitary'.habitat: The habitat of the mushroom. Available values are: 'grasses', 'leaves', 'meadows', 'paths', 'urban', 'waste', 'woods'.
Example:
Or, use the GET method:
Response
Upon a successful request, using the Myconom API you will receive a JSON response with the model's prediction. If the API token is invalid or the request fails, an error message will be included in the response.
Example response:
The response contains the model's prediction.
Usage example
Here's a usage example in JavaScript using the fetch API:
Make sure to replace 'YOUR_API_KEY' with your actual API token.
This example puts your API key in the code, which is fine on your own machine while you test — but don't ship it in a public website or app: anyone can open the browser's developer tools, copy it, and spend your calls. To try the request without a key at all, use mock mode in the API playground. In production, call the API from your own server or a serverless function, and have your front end call that. See Keeping your API key safe.
Error handling
The API may return error responses in case of invalid input or other issues. Be sure to handle errors gracefully in your application. Error responses will include appropriate status codes and error messages in the JSON format.
Parameters
Here are all the available parameters for the API:
POST method
apiKey
Your standard API key (INF-)
false
capShape
The cap shape of the mushroom. Available values are: 'bell', 'conical', 'convex', 'flat', 'knobbed', 'sunken'.
false
capSurface
The cap surface of the mushroom. Available values are: 'fibrous', 'grooves', 'scaly', 'smooth'.
false
capColor
The cap color of the mushroom. Available values are: 'brown', 'buff', 'cinnamon', 'gray', 'green', 'pink', 'purple', 'red', 'white', 'yellow'.
false
bruises
If the mushroom has bruises. Available values are: 'bruises', 'no'.
false
odor
The odor of the mushroom. Available values are: 'almond', 'anise', 'creosote', 'fishy', 'foul', 'musty', 'none', 'pungent', 'spicy'.
false
gillAttachment
The gill attachment of the mushroom. Available values are: 'attached', 'descending', 'free', 'notched'.
false
gillSpacing
The gill spacing of the mushroom. Available values are: 'close', 'crowded', 'distant'.
false
gillSize
The gill size of the mushroom. Available values are: 'broad', 'narrow'.
false
gillColor
The color of the mushroom's gills. Available values are: 'black', 'brown', 'buff', 'chocolate', 'gray', 'green', 'orange', 'pink', 'purple', 'red', 'white', 'yellow'.
false
stalkShape
The stalk shape of the mushroom. Available values are: 'enlarging', 'tapering'.
false
stalkRoot
The stalk root of the mushroom. Available values are: 'bulbous', 'club', 'cup', 'equal', 'rhizomorphs', 'rooted', 'missing'.
false
stalkSurfaceAboveRing
The stalk surface above the ring of the mushroom. Available values are: 'fibrous', 'scaly', 'silky', 'smooth'.
false
stalkSurfaceBelowRing
The stalk surface below the ring of the mushroom. Available values are: 'fibrous', 'scaly', 'silky', 'smooth'.
false
stalkColorAboveRing
The stalk color above the ring of the mushroom. Available values are: 'brown', 'buff', 'cinnamon', 'gray', 'orange', 'pink', 'red', 'white', 'yellow'.
false
stalkColorBelowRing
The stalk color below the ring of the mushroom. Available values are: 'brown', 'buff', 'cinnamon', 'gray', 'orange', 'pink', 'red', 'white', 'yellow'.
false
veilType
The veil type of the mushroom. Available values are: 'partial', 'universal'.
false
veilColor
The veil color of the mushroom. Available values are: 'brown', 'orange', 'white', 'yellow'.
false
ringNumber
The number of rings of the mushroom. Available values are: 'none', 'one', 'two'.
false
ringType
The ring type of the mushroom. Available values are: 'cobwebby', 'evanescent', 'flaring', 'large', 'none', 'pendant', 'sheathing', 'zone'.
false
sporePrintColor
The spore print color of the mushroom. Available values are: 'black', 'brown', 'buff', 'chocolate', 'green', 'orange', 'purple', 'white', 'yellow'.
false
population
The population density of the mushroom. Available values are: 'abundant', 'clustered', 'numerous', 'scattered', 'several', 'solitary'.
false
habitat
The habitat of the mushroom. Available values are: 'grasses', 'leaves', 'meadows', 'paths', 'urban', 'waste', 'woods'.
false
GET method
token
Your standard API key (INF-)
false
capShape
The cap shape of the mushroom. Available values are: 'bell', 'conical', 'convex', 'flat', 'knobbed', 'sunken'.
false
capSurface
The cap surface of the mushroom. Available values are: 'fibrous', 'grooves', 'scaly', 'smooth'.
false
capColor
The cap color of the mushroom. Available values are: 'brown', 'buff', 'cinnamon', 'gray', 'green', 'pink', 'purple', 'red', 'white', 'yellow'.
false
bruises
If the mushroom has bruises. Available values are: 'bruises', 'no'.
false
odor
The odor of the mushroom. Available values are: 'almond', 'anise', 'creosote', 'fishy', 'foul', 'musty', 'none', 'pungent', 'spicy'.
false
gillAttachment
The gill attachment of the mushroom. Available values are: 'attached', 'descending', 'free', 'notched'.
false
gillSpacing
The gill spacing of the mushroom. Available values are: 'close', 'crowded', 'distant'.
false
gillSize
The gill size of the mushroom. Available values are: 'broad', 'narrow'.
false
gillColor
The color of the mushroom's gills. Available values are: 'black', 'brown', 'buff', 'chocolate', 'gray', 'green', 'orange', 'pink', 'purple', 'red', 'white', 'yellow'.
false
stalkShape
The stalk shape of the mushroom. Available values are: 'enlarging', 'tapering'.
false
stalkRoot
The stalk root of the mushroom. Available values are: 'bulbous', 'club', 'cup', 'equal', 'rhizomorphs', 'rooted', 'missing'.
false
stalkSurfaceAboveRing
The stalk surface above the ring of the mushroom. Available values are: 'fibrous', 'scaly', 'silky', 'smooth'.
false
stalkSurfaceBelowRing
The stalk surface below the ring of the mushroom. Available values are: 'fibrous', 'scaly', 'silky', 'smooth'.
false
stalkColorAboveRing
The stalk color above the ring of the mushroom. Available values are: 'brown', 'buff', 'cinnamon', 'gray', 'orange', 'pink', 'red', 'white', 'yellow'.
false
stalkColorBelowRing
The stalk color below the ring of the mushroom. Available values are: 'brown', 'buff', 'cinnamon', 'gray', 'orange', 'pink', 'red', 'white', 'yellow'.
false
veilType
The veil type of the mushroom. Available values are: 'partial', 'universal'.
false
veilColor
The veil color of the mushroom. Available values are: 'brown', 'orange', 'white', 'yellow'.
false
ringNumber
The number of rings of the mushroom. Available values are: 'none', 'one', 'two'.
false
ringType
The ring type of the mushroom. Available values are: 'cobwebby', 'evanescent', 'flaring', 'large', 'none', 'pendant', 'sheathing', 'zone'.
false
sporePrintColor
The spore print color of the mushroom. Available values are: 'black', 'brown', 'buff', 'chocolate', 'green', 'orange', 'purple', 'white', 'yellow'.
false
population
The population density of the mushroom. Available values are: 'abundant', 'clustered', 'numerous', 'scattered', 'several', 'solitary'.
false
habitat
The habitat of the mushroom. Available values are: 'grasses', 'leaves', 'meadows', 'paths', 'urban', 'waste', 'woods'.
false
⚠️ Error codes
Here are a few of the error codes, you will receive in responses, to help clarify issues:
Common error codes
400
Missing or invalid parameters. This is when the parameters you passed to the API, do not match the API's expected inputs.
405
Using an invalid method, to access the API.
429
The rate limit is exceeded within the current timeframe.
401
Invalid API key, no remaining calls (No remaining API calls.), or an error while processing your input.
Our APIs are rigorously tested before deployments, to ensure that they do not produce any unintentional errors during production.
⌛ Rate limiting
We use rate limiting, to protect our API's resources. Rate limiting is implemented on all of our APIs, and follows these general principles:
interval: The rate limiting is set to a default interval of1 minute.amount of requests: The amount of requests is set to a default of25 requestswithin the given interval.
If the rate limit is exceeded, an error 429 code will be returned, instead of the actual API output.
⭐ Best practices
Common guidelines to use, optimize, and protect your implementation of our APIs.
Do not store/share/expose your API keys. See Keeping your API key safe
Implement data cleaning, and validation in your code, to ensure inputs are sanitized
Handle API errors gracefully
Try this endpoint in the API playground — mock mode returns dummy data in the real response shape, with no API key and no calls used
Handle API outputs accordingly. You can see examples of this API's output in the Endpoint section.
Implement code to notify users of actions when using our APIs, such as errors, delays, formatting issues, etc.
❓ FAQs
Answers to the most common questions and issues when using this API:
I am getting a 405 error, what should I do?
A 405 error means the endpoint exists, but the HTTP method doesn't: use POST or GET, since this endpoint does not accept other HTTP methods. A 404 or NotFound error is different — it means the route doesn't exist, usually because the endpoint URL was misspelled.
Is rate limiting set individually, or per API key?
Rate limiting is set individually, this means that rate limiting happens on an end-user level. This ensures that our API is used fairly, among all users.
Are request timeouts a thing?
Yes, we normally timeout requests after the 10-second mark. This, however, can vary significantly, depending on various other factors.
What is the max payload size?
The maximum payload size for buffered executions is 4.5mb per request. For streamed executions, we use a payload restriction size of 20mb per request.
What is the recommended way to call the API?
If you can, call the API using the POST method. The GET method works but is not recommended, especially when you're calling it by directly modifying the URL. This is because URL parameters that are strings, can sometimes be misformatted afterwards, and then incorrectly passed to the API.
Is this AI model accurate?
Yes, on our testing sets, the model scored an extremely high accuracy score of 100%, however, when cross-validation was used, the model scored an average of 91.1%, showing that it struggled with specific instances/samples.
However, this model is for educational purposes only. Read the disclaimer for more information.
OpenAPI
You can download the OpenAPI specification for this API to learn more about how it works and how to use it. The OpenAPI specification is a standard, language-agnostic interface to RESTful APIs that allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection.
Download OpenAPI Specification
Conclusion
That's it! You now know the basics of using the MycoNom API. Don't hesitate to contact our support team with further questions or issues.
Last updated
Authorization: Bearer YOUR_API_KEY{
"apiKey": "YOUR_API_KEY"
}https://infinitode.netlify.app/api/v1/myconom?token=YOUR_API_KEYhttps://infinitode.netlify.app/api/v1/myconom{
"apiKey": "YOUR_API_KEY",
"capShape": "bell",
"capSurface": "fibrous",
"capColor": "brown",
"bruises": "bruises",
"odor": "almond",
"gillAttachment": "attached",
"gillSpacing": "close",
"gillSize": "broad",
"gillColor": "black",
"stalkShape": "enlarging",
"stalkRoot": "bulbous",
"stalkSurfaceAboveRing": "fibrous",
"stalkSurfaceBelowRing": "fibrous",
"stalkColorAboveRing": "brown",
"stalkColorBelowRing": "brown",
"veilType": "partial",
"veilColor": "brown",
"ringNumber": "none",
"ringType": "cobwebby",
"sporePrintColor": "black",
"population": "abundant",
"habitat": "grasses"
}https://infinitode.netlify.app/api/v1/myconom?token=YOUR_API_KEY&capShape=bell&capSurface=fibrous&capColor=brown&bruises=bruises&odor=almond&gillAttachment=attached&gillSpacing=close&gillSize=broad&gillColor=black&stalkShape=enlarging&stalkRoot=bulbous&stalkSurfaceAboveRing=fibrous&stalkSurfaceBelowRing=fibrous&stalkColorAboveRing=brown&stalkColorBelowRing=brown&veilType=partial&veilColor=brown&ringNumber=none&ringType=cobwebby&sporePrintColor=black&population=abundant&habitat=grasses{
"prediction": "Edible"
}const apiUrl = 'https://infinitode.netlify.app/api/v1/myconom';
const data = {
"apiKey": "YOUR_API_KEY",
"capShape": "bell",
"capSurface": "fibrous",
"capColor": "brown",
"bruises": "bruises",
"odor": "almond",
"gillAttachment": "attached",
"gillSpacing": "close",
"gillSize": "broad",
"gillColor": "black",
"stalkShape": "enlarging",
"stalkRoot": "bulbous",
"stalkSurfaceAboveRing": "fibrous",
"stalkSurfaceBelowRing": "fibrous",
"stalkColorAboveRing": "brown",
"stalkColorBelowRing": "brown",
"veilType": "partial",
"veilColor": "brown",
"ringNumber": "none",
"ringType": "cobwebby",
"sporePrintColor": "black",
"population": "abundant",
"habitat": "grasses"
};
fetch(apiUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(data),
})
.then(response => response.json())
.then(result => {
console.log('Prediction:', result.prediction);
})
.catch(error => {
console.error('Error:', error);
});