Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/sorgm/data-architecture-docs/llms.txt

Use this file to discover all available pages before exploring further.

Overview

The Create Plant endpoint allows you to add a new plant to the store. Each plant must have a unique name and can optionally include a tag for categorization.

Endpoint

POST /plants

Authentication

This endpoint requires Bearer token authentication. Include your token in the Authorization header:
Authorization: Bearer YOUR_TOKEN

Request Body

The request body must be sent as JSON with the Content-Type: application/json header.
name
string
required
The name of the plant. This is a required field and should contain the common or scientific name of the plant.Requirements:
  • Must be a non-empty string
  • Should be unique within your plant collection
Examples:
  • “Monstera Deliciosa”
  • “Sansevieria Trifasciata”
  • “Pothos”
tag
string
Optional tag to categorize or classify the plant. Use tags to organize your plant collection by type, location, care requirements, or any other classification system.Suggested tags:
  • “tropical” - Tropical plants requiring warm, humid conditions
  • “succulent” - Water-storing plants requiring minimal watering
  • “flowering” - Plants that produce flowers
  • “indoor” - Plants suitable for indoor growing
  • “outdoor” - Plants suitable for outdoor growing
  • “low-light” - Plants that thrive in low-light conditions
  • “pet-safe” - Plants that are non-toxic to pets

Request Example

curl -X POST \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Monstera Deliciosa",
    "tag": "tropical"
  }' \
  "http://sandbox.mintlify.com/plants"

Response

Success Response (200)

Returns the created plant object with the assigned ID.
id
integer
required
Unique identification number automatically assigned to the plant when it’s created. Use this ID for subsequent operations like deletion.
name
string
required
The name of the plant as provided in the request
tag
string
The tag assigned to the plant, if provided in the request
{
  "id": 42,
  "name": "Monstera Deliciosa",
  "tag": "tropical"
}

Error Response (400)

Returned when the request is invalid or cannot be processed.
error
integer
required
The error code indicating the type of error that occurred
message
string
required
A descriptive error message explaining what went wrong and how to fix it
{
  "error": 400,
  "message": "Plant name is required and cannot be empty"
}

Usage Examples

Create a Simple Plant

Create a plant with just a name:
curl -X POST \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "Spider Plant"}' \
  "http://sandbox.mintlify.com/plants"

Create a Tagged Plant

Create a plant with both name and tag:
curl -X POST \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Aloe Vera",
    "tag": "succulent"
  }' \
  "http://sandbox.mintlify.com/plants"

Batch Create Plants

Create multiple plants sequentially:
const plantsToCreate = [
  { name: 'Pothos', tag: 'indoor' },
  { name: 'Snake Plant', tag: 'low-light' },
  { name: 'Peace Lily', tag: 'flowering' }
];

for (const plant of plantsToCreate) {
  const response = await fetch('http://sandbox.mintlify.com/plants', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_TOKEN',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify(plant)
  });
  
  const created = await response.json();
  console.log(`Created plant with ID: ${created.id}`);
}
Ensure that plant names are unique to avoid confusion. While the API may allow duplicate names, it’s best practice to use unique identifiers.

Common Error Scenarios

Missing Required Field

Request:
{
  "tag": "tropical"
}

Response (400):
{
  "error": 400,
  "message": "Plant name is required and cannot be empty"
}

Invalid Content Type

Forgetting to set the Content-Type header to application/json will result in an error:
# Incorrect - missing Content-Type header
curl -X POST \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{"name": "Plant"}' \
  "http://sandbox.mintlify.com/plants"

Unauthorized Request

Response (401):
{
  "error": 401,
  "message": "Invalid or missing authentication token"
}
After creating a plant, save the returned ID if you need to reference or delete the plant later. The ID is auto-generated and cannot be specified in the request.

Best Practices

  • Validate input before sending the request to reduce errors
  • Use meaningful tags to organize your plant collection effectively
  • Store the returned ID for future operations on the plant
  • Handle duplicate names in your application logic
  • Implement error handling for network failures and validation errors

Build docs developers (and LLMs) love