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

# Create Turn

POST https://api.fortresstech.io/v1/turns
Content-Type: application/json

Creates a turn record for a unit and transitions it from "Vacant / Not Ready" to "Vacant - Ready" status.


Reference: https://developer.fortresstech.io/api-reference/turns/create-turn

## Authentication

- `x-api-key` header (required) — API Key authentication via header

## Request

### Body (application/json)

This endpoint expects a CreateRequest.

- `unitId` (string, required) — The ID of the unit to create a turn for
- `actualDate` (date, required) — The actual ready date when the unit turn was completed. Must not be in the future and must be after the last move-out date.
- `idempotencyId` (string, required) — Unique identifier to prevent duplicate turn creation

## Response

### 200

Turn successfully created

- `date` (date, required) — The actual ready date when the turn was completed
- `unitId` (string, required) — The unit that was turned
- `idempotencyId` (string, required) — Unique identifier to prevent duplicate turn creation
- `createdById` (string, optional) — The user who created the turn record
- `id` (string, optional)
- `createdAt` (datetime, optional)
- `updatedAt` (datetime, optional)
- `deletedAt` (datetime, optional)

## Errors

### 400 Bad Request Error

Bad Request

- `message` (string, optional)
- `statusCode` (integer, optional)

### 404 Not Found Error

Not Found

- `message` (string, optional)
- `statusCode` (integer, optional)

## Examples

### Successfully created turn

**Response**

```json
{
  "date": "2024-01-15",
  "unitId": "unit-id-456",
  "idempotencyId": "123e4567-e89b-12d3-a456-426614174000",
  "createdById": "f75a9967-2e0a-42af-88e0-e9be8aea0fbd",
  "id": "turn-id-123",
  "createdAt": "2024-01-15T10:30:00.000Z",
  "updatedAt": "2024-01-15T10:30:00.000Z"
}
```

**SDK Code**

```python Successfully created turn
import requests

url = "https://api.fortresstech.io/v1/turns"

headers = {"x-api-key": "<apiKey>"}

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

print(response.json())
```

```javascript Successfully created turn
const url = 'https://api.fortresstech.io/v1/turns';
const options = {method: 'POST', headers: {'x-api-key': '<apiKey>'}};

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

```go Successfully created turn
package main

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

func main() {

	url := "https://api.fortresstech.io/v1/turns"

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

	req.Header.Add("x-api-key", "<apiKey>")

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

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

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

}
```

```ruby Successfully created turn
require 'uri'
require 'net/http'

url = URI("https://api.fortresstech.io/v1/turns")

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

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'

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

```java Successfully created turn
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.fortresstech.io/v1/turns")
  .header("x-api-key", "<apiKey>")
  .asString();
```

```php Successfully created turn
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.fortresstech.io/v1/turns', [
  'headers' => [
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Successfully created turn
using RestSharp;

var client = new RestClient("https://api.fortresstech.io/v1/turns");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift Successfully created turn
import Foundation

let headers = ["x-api-key": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.fortresstech.io/v1/turns")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

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()
```

### Create a turn

**Request**

```json
{
  "unitId": "unit-id-456",
  "actualDate": "2024-01-15",
  "idempotencyId": "123e4567-e89b-12d3-a456-426614174000"
}
```

**Response**

```json
{
  "date": "2024-01-15",
  "unitId": "unit-id-456",
  "idempotencyId": "123e4567-e89b-12d3-a456-426614174000",
  "createdById": "f75a9967-2e0a-42af-88e0-e9be8aea0fbd",
  "id": "turn-id-123",
  "createdAt": "2024-01-15T10:30:00.000Z",
  "updatedAt": "2024-01-15T10:30:00.000Z"
}
```

**SDK Code**

```python Create a turn
import requests

url = "https://api.fortresstech.io/v1/turns"

payload = {
    "unitId": "unit-id-456",
    "actualDate": "2024-01-15",
    "idempotencyId": "123e4567-e89b-12d3-a456-426614174000"
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Create a turn
const url = 'https://api.fortresstech.io/v1/turns';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"unitId":"unit-id-456","actualDate":"2024-01-15","idempotencyId":"123e4567-e89b-12d3-a456-426614174000"}'
};

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

```go Create a turn
package main

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

func main() {

	url := "https://api.fortresstech.io/v1/turns"

	payload := strings.NewReader("{\n  \"unitId\": \"unit-id-456\",\n  \"actualDate\": \"2024-01-15\",\n  \"idempotencyId\": \"123e4567-e89b-12d3-a456-426614174000\"\n}")

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

	req.Header.Add("x-api-key", "<apiKey>")
	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 Create a turn
require 'uri'
require 'net/http'

url = URI("https://api.fortresstech.io/v1/turns")

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

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"unitId\": \"unit-id-456\",\n  \"actualDate\": \"2024-01-15\",\n  \"idempotencyId\": \"123e4567-e89b-12d3-a456-426614174000\"\n}"

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

```java Create a turn
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.fortresstech.io/v1/turns")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"unitId\": \"unit-id-456\",\n  \"actualDate\": \"2024-01-15\",\n  \"idempotencyId\": \"123e4567-e89b-12d3-a456-426614174000\"\n}")
  .asString();
```

```php Create a turn
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.fortresstech.io/v1/turns', [
  'body' => '{
  "unitId": "unit-id-456",
  "actualDate": "2024-01-15",
  "idempotencyId": "123e4567-e89b-12d3-a456-426614174000"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Create a turn
using RestSharp;

var client = new RestClient("https://api.fortresstech.io/v1/turns");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"unitId\": \"unit-id-456\",\n  \"actualDate\": \"2024-01-15\",\n  \"idempotencyId\": \"123e4567-e89b-12d3-a456-426614174000\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Create a turn
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "unitId": "unit-id-456",
  "actualDate": "2024-01-15",
  "idempotencyId": "123e4567-e89b-12d3-a456-426614174000"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.fortresstech.io/v1/turns")! 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()
```