> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://will-test.ferndocs.com/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://will-test.ferndocs.com/docs/_mcp/server.

# Add an API

POST https://api.example.com/v1/plants
Content-Type: application/json

This is a sample endpoint. If you've added your OpenAPI spec, your API reference is building now. Check GitHub Actions and refresh when complete.

Reference: https://will-test.ferndocs.com/docs/api-reference/swagger-petstore-open-api-3-0/plants/add-plant

## Request

### Body (application/json)

This endpoint expects a PlantRequest.

- `name` (string, required) — Display name for the plant
- `species` (string, required) — Scientific name of the plant
- `wateringFrequency` (enum, optional) — How often the plant needs water
  - Allowed values: `daily`, `weekly`, `biweekly`, `monthly`
- `sunlight` (enum, optional) — Sunlight requirements
  - Allowed values: `direct`, `indirect`, `shade`

## Response

### 201

Plant successfully added

- `id` (string, optional) — Unique identifier for the plant
- `name` (string, optional) — Display name for the plant
- `species` (string, optional) — Scientific name of the plant
- `wateringFrequency` (enum, optional)
  - Allowed values: `daily`, `weekly`, `biweekly`, `monthly`
- `sunlight` (enum, optional)
  - Allowed values: `direct`, `indirect`, `shade`
- `createdAt` (datetime, optional) — When the plant was added

## Errors

### 400 Bad Request Error

Invalid input

- `any`

## Examples

### Boston Fern created

**Response**

```json
{
  "id": "plant_001",
  "name": "Boston Fern",
  "species": "Nephrolepis exaltata",
  "wateringFrequency": "daily",
  "sunlight": "indirect",
  "createdAt": "2026-01-01T00:00:00Z"
}
```

**SDK Code**

```python Boston Fern created
import requests

url = "https://api.example.com/v1/plants"

response = requests.post(url)

print(response.json())
```

```javascript Boston Fern created
const url = 'https://api.example.com/v1/plants';
const options = {method: 'POST'};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Boston Fern created
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.example.com/v1/plants"

	req, _ := http.NewRequest("POST", url, nil)

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Boston Fern created
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v1/plants")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
```

```java Boston Fern created
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.example.com/v1/plants")
  .asString();
```

```php Boston Fern created
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.example.com/v1/plants');

echo $response->getBody();
```

```csharp Boston Fern created
using RestSharp;

var client = new RestClient("https://api.example.com/v1/plants");
var request = new RestRequest(Method.POST);
IRestResponse response = client.Execute(request);
```

```swift Boston Fern created
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/v1/plants")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Jade Plant created

**Response**

```json
{
  "id": "plant_002",
  "name": "Jade Plant",
  "species": "Crassula ovata",
  "wateringFrequency": "weekly",
  "sunlight": "direct",
  "createdAt": "2026-01-01T00:00:00Z"
}
```

**SDK Code**

```python Jade Plant created
import requests

url = "https://api.example.com/v1/plants"

response = requests.post(url)

print(response.json())
```

```javascript Jade Plant created
const url = 'https://api.example.com/v1/plants';
const options = {method: 'POST'};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Jade Plant created
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.example.com/v1/plants"

	req, _ := http.NewRequest("POST", url, nil)

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Jade Plant created
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v1/plants")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
```

```java Jade Plant created
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.example.com/v1/plants")
  .asString();
```

```php Jade Plant created
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.example.com/v1/plants');

echo $response->getBody();
```

```csharp Jade Plant created
using RestSharp;

var client = new RestClient("https://api.example.com/v1/plants");
var request = new RestRequest(Method.POST);
IRestResponse response = client.Execute(request);
```

```swift Jade Plant created
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/v1/plants")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Add a Boston Fern

**Request**

```json
{
  "name": "Boston Fern",
  "species": "Nephrolepis exaltata",
  "wateringFrequency": "daily",
  "sunlight": "indirect"
}
```

**Response**

```json
{
  "id": "plant_001",
  "name": "Boston Fern",
  "species": "Nephrolepis exaltata",
  "wateringFrequency": "daily",
  "sunlight": "indirect",
  "createdAt": "2026-01-01T00:00:00Z"
}
```

**SDK Code**

```python Add a Boston Fern
import requests

url = "https://api.example.com/v1/plants"

payload = {
    "name": "Boston Fern",
    "species": "Nephrolepis exaltata",
    "wateringFrequency": "daily",
    "sunlight": "indirect"
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Add a Boston Fern
const url = 'https://api.example.com/v1/plants';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"name":"Boston Fern","species":"Nephrolepis exaltata","wateringFrequency":"daily","sunlight":"indirect"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Add a Boston Fern
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.example.com/v1/plants"

	payload := strings.NewReader("{\n  \"name\": \"Boston Fern\",\n  \"species\": \"Nephrolepis exaltata\",\n  \"wateringFrequency\": \"daily\",\n  \"sunlight\": \"indirect\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Add a Boston Fern
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v1/plants")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"Boston Fern\",\n  \"species\": \"Nephrolepis exaltata\",\n  \"wateringFrequency\": \"daily\",\n  \"sunlight\": \"indirect\"\n}"

response = http.request(request)
puts response.read_body
```

```java Add a Boston Fern
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.example.com/v1/plants")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Boston Fern\",\n  \"species\": \"Nephrolepis exaltata\",\n  \"wateringFrequency\": \"daily\",\n  \"sunlight\": \"indirect\"\n}")
  .asString();
```

```php Add a Boston Fern
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.example.com/v1/plants', [
  'body' => '{
  "name": "Boston Fern",
  "species": "Nephrolepis exaltata",
  "wateringFrequency": "daily",
  "sunlight": "indirect"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Add a Boston Fern
using RestSharp;

var client = new RestClient("https://api.example.com/v1/plants");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Boston Fern\",\n  \"species\": \"Nephrolepis exaltata\",\n  \"wateringFrequency\": \"daily\",\n  \"sunlight\": \"indirect\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Add a Boston Fern
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "name": "Boston Fern",
  "species": "Nephrolepis exaltata",
  "wateringFrequency": "daily",
  "sunlight": "indirect"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/v1/plants")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Add a Jade Plant

**Request**

```json
{
  "name": "Jade Plant",
  "species": "Crassula ovata",
  "wateringFrequency": "weekly",
  "sunlight": "direct"
}
```

**Response**

```json
{
  "id": "plant_001",
  "name": "Boston Fern",
  "species": "Nephrolepis exaltata",
  "wateringFrequency": "daily",
  "sunlight": "indirect",
  "createdAt": "2026-01-01T00:00:00Z"
}
```

**SDK Code**

```python Add a Jade Plant
import requests

url = "https://api.example.com/v1/plants"

payload = {
    "name": "Jade Plant",
    "species": "Crassula ovata",
    "wateringFrequency": "weekly",
    "sunlight": "direct"
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Add a Jade Plant
const url = 'https://api.example.com/v1/plants';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"name":"Jade Plant","species":"Crassula ovata","wateringFrequency":"weekly","sunlight":"direct"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Add a Jade Plant
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.example.com/v1/plants"

	payload := strings.NewReader("{\n  \"name\": \"Jade Plant\",\n  \"species\": \"Crassula ovata\",\n  \"wateringFrequency\": \"weekly\",\n  \"sunlight\": \"direct\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Add a Jade Plant
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v1/plants")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"Jade Plant\",\n  \"species\": \"Crassula ovata\",\n  \"wateringFrequency\": \"weekly\",\n  \"sunlight\": \"direct\"\n}"

response = http.request(request)
puts response.read_body
```

```java Add a Jade Plant
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.example.com/v1/plants")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Jade Plant\",\n  \"species\": \"Crassula ovata\",\n  \"wateringFrequency\": \"weekly\",\n  \"sunlight\": \"direct\"\n}")
  .asString();
```

```php Add a Jade Plant
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.example.com/v1/plants', [
  'body' => '{
  "name": "Jade Plant",
  "species": "Crassula ovata",
  "wateringFrequency": "weekly",
  "sunlight": "direct"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Add a Jade Plant
using RestSharp;

var client = new RestClient("https://api.example.com/v1/plants");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Jade Plant\",\n  \"species\": \"Crassula ovata\",\n  \"wateringFrequency\": \"weekly\",\n  \"sunlight\": \"direct\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Add a Jade Plant
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "name": "Jade Plant",
  "species": "Crassula ovata",
  "wateringFrequency": "weekly",
  "sunlight": "direct"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/v1/plants")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```