> This page is for version V1 (default).
> For other versions, use one of these documentation indexes:
> - V1 (default): https://docs.ottimate.com/v-1/llms.txt

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

# Create a single new dimension

POST https://api.ottimate.com/v1/dimensions
Content-Type: application/json

Creates a new dimension with the provided details. All fields in the request body are required. This endpoint does not upsert: if a dimension with the same `reference_id` and `erp_type` already exists for the company, the request is rejected with a 400 error instead of updating the existing record. To update an existing dimension, use `POST /dimensions/bulk`, which upserts by `reference_id` + `erp_type`.

Reference: https://docs.ottimate.com/api-reference/api-reference/dimensions/post-dimensions-root

## Authentication

- `Authorization` header (bearer token, required) — OAuth2 authentication flows. Auth server URLs will vary by environment

## Servers

- `https://api.ottimate.com/v1` (Production, default)
- `https://sandbox-api.ottimate.com/v1` (Sandbox)

## Request

### Headers

- `X-Api-Key` (string, required) — API key for authentication
- `X-API-Version` (string, optional) — API version to use (optional, defaults to latest). Supported values: 1.0.0, 1.1.0.
- `Idempotency-Key` (string, optional) — Client-generated unique key (UUID/ULID recommended). JSON requests: the first 2xx response is cached for 24h and replayed on a same-key retry with a matching body; a different body returns 422. Non-JSON requests (e.g. file uploads): the key is single-use — any same-key retry returns 422 regardless of body. See [Idempotency](https://docs.ottimate.com/idempotency) for full details.

### Body (application/json)

This endpoint expects an object.

- `ottimate_company_id` (integer, required) — The Ottimate company ID this dimension belongs to
- `erp_type` (string, required) — The dimension category label as displayed in the client's ERP system (e.g., 'Account', 'GLACCOUNT', 'Department'). This is client-specific.
- `ottimate_type` (enum, required) — Ottimate's standardized dimension type code for consistent categorization.
  - Allowed values: `account`, `location`, `department`, `class`, `project`, `customer`, `entity`, `item`, `warehouse`, `task`, `cost_type`, `employee`, `tax_code`, `property`, `company`, `subsidiary`
- `name` (string, required) — Display name of the dimension
- `code` (string, required) — The GL code or short identifier for this dimension in the client's ERP system
- `reference_id` (string, required) — A unique reference identifier that tracks this dimension across all client systems (ERP, inventory management, Ottimate)
- `erp_dimension_id` (string, required) — The identifier assigned to this dimension by the client's ERP software

## Response

### 200

Successfully created. The created dimension is returned nested under a `dimension` key, matching the shape of the GET /dimensions/\{id} response. There is no timestamp field (e.g. `created_date`) in the response.

- `version` (string, optional)
- `dimension` (DimensionsPostResponsesContentApplicationJsonSchemaDimension, optional)

## Errors

### 400 Bad Request Error

Bad Request. Also returned when a dimension with the same `reference_id` and `erp_type` already exists for the company (this endpoint does not upsert).

- `code` (string, required) — Machine-readable error code: an app-specific prefix (e.g. 'INV' for invoices, 'RCPT' for receipts, 'CAT' for catalog) followed by a 4-digit code, e.g. INV4000 for a generic 4xx (validation, not found, etc).
- `message` (ErrorResponseMessage, required, nullable) — Additional error details, can be an object, a string, or null.
- `request_id` (string, optional) — Unique identifier for the request
- `timestamp` (string, optional) — Request timestamp in API Gateway's log format (not ISO 8601).

### 403 Forbidden Error

Forbidden - Access denied or insufficient permissions

- `Post_dimensions_rootRequestForbiddenError`
  - ErrorResponse
  - GatewayForbiddenResponse

### 422 Unprocessable Entity Error

Unprocessable entity - Request validation failed

- `code` (string, required) — Machine-readable error code: an app-specific prefix (e.g. 'INV' for invoices, 'RCPT' for receipts, 'CAT' for catalog) followed by a 4-digit code, e.g. INV4000 for a generic 4xx (validation, not found, etc).
- `message` (ErrorResponseMessage, required, nullable) — Additional error details, can be an object, a string, or null.
- `request_id` (string, optional) — Unique identifier for the request
- `timestamp` (string, optional) — Request timestamp in API Gateway's log format (not ISO 8601).

## Types

### DimensionsPostResponsesContentApplicationJsonSchemaDimension

- `id` (string, optional)
- `name` (string, optional)
- `erp_type` (string, optional) — The dimension category label in client's ERP system
- `code` (string, optional)
- `reference_id` (string, optional)
- `ottimate_type` (enum, optional) — Ottimate's standardized dimension type code
  - Allowed values: `account`, `location`, `department`, `class`, `project`, `customer`, `entity`, `item`, `warehouse`, `task`, `cost_type`, `employee`, `tax_code`, `property`, `company`, `subsidiary`
- `erp_dimension_id` (string, optional)
- `ottimate_company_id` (integer, optional)

### ErrorResponseMessage

Additional error details, can be an object, a string, or null.

- map from string to any
- string

### ErrorResponse

- `code` (string, required) — Machine-readable error code: an app-specific prefix (e.g. 'INV' for invoices, 'RCPT' for receipts, 'CAT' for catalog) followed by a 4-digit code, e.g. INV4000 for a generic 4xx (validation, not found, etc).
- `message` (ErrorResponseMessage, required, nullable) — Additional error details, can be an object, a string, or null.
- `request_id` (string, optional) — Unique identifier for the request
- `timestamp` (string, optional) — Request timestamp in API Gateway's log format (not ISO 8601).

### GatewayForbiddenResponse

Bare API Gateway rejection (e.g. missing/invalid X-Api-Key), distinct from the app-level ErrorResponse envelope.

- `message` (string, required)

## Examples

**Request**

```json
{
  "ottimate_company_id": 15196,
  "erp_type": "Department",
  "ottimate_type": "department",
  "name": "Marketing Department",
  "code": "MKT",
  "reference_id": "dept-mkt-001",
  "erp_dimension_id": "DEPT-MKT-001"
}
```

**Response**

```json
{
  "version": "1.0.0",
  "dimension": {
    "id": "dim_ABC12345XYZ",
    "name": "Marketing Department",
    "erp_type": "Department",
    "code": "MKT",
    "reference_id": "dept-mkt-001",
    "ottimate_type": "department",
    "erp_dimension_id": "DEPT-MKT-001",
    "ottimate_company_id": 15196
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.ottimate.com/v1/dimensions"

payload = {
    "ottimate_company_id": 15196,
    "erp_type": "Department",
    "ottimate_type": "department",
    "name": "Marketing Department",
    "code": "MKT",
    "reference_id": "dept-mkt-001",
    "erp_dimension_id": "DEPT-MKT-001"
}
headers = {
    "X-Api-Key": "your-api-key-here",
    "X-API-Version": "1.0.0",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.ottimate.com/v1/dimensions';
const options = {
  method: 'POST',
  headers: {
    'X-Api-Key': 'your-api-key-here',
    'X-API-Version': '1.0.0',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: '{"ottimate_company_id":15196,"erp_type":"Department","ottimate_type":"department","name":"Marketing Department","code":"MKT","reference_id":"dept-mkt-001","erp_dimension_id":"DEPT-MKT-001"}'
};

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

```go
package main

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

func main() {

	url := "https://api.ottimate.com/v1/dimensions"

	payload := strings.NewReader("{\n  \"ottimate_company_id\": 15196,\n  \"erp_type\": \"Department\",\n  \"ottimate_type\": \"department\",\n  \"name\": \"Marketing Department\",\n  \"code\": \"MKT\",\n  \"reference_id\": \"dept-mkt-001\",\n  \"erp_dimension_id\": \"DEPT-MKT-001\"\n}")

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

	req.Header.Add("X-Api-Key", "your-api-key-here")
	req.Header.Add("X-API-Version", "1.0.0")
	req.Header.Add("Authorization", "Bearer <token>")
	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
require 'uri'
require 'net/http'

url = URI("https://api.ottimate.com/v1/dimensions")

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

request = Net::HTTP::Post.new(url)
request["X-Api-Key"] = 'your-api-key-here'
request["X-API-Version"] = '1.0.0'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"ottimate_company_id\": 15196,\n  \"erp_type\": \"Department\",\n  \"ottimate_type\": \"department\",\n  \"name\": \"Marketing Department\",\n  \"code\": \"MKT\",\n  \"reference_id\": \"dept-mkt-001\",\n  \"erp_dimension_id\": \"DEPT-MKT-001\"\n}"

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

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.ottimate.com/v1/dimensions")
  .header("X-Api-Key", "your-api-key-here")
  .header("X-API-Version", "1.0.0")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"ottimate_company_id\": 15196,\n  \"erp_type\": \"Department\",\n  \"ottimate_type\": \"department\",\n  \"name\": \"Marketing Department\",\n  \"code\": \"MKT\",\n  \"reference_id\": \"dept-mkt-001\",\n  \"erp_dimension_id\": \"DEPT-MKT-001\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.ottimate.com/v1/dimensions', [
  'body' => '{
  "ottimate_company_id": 15196,
  "erp_type": "Department",
  "ottimate_type": "department",
  "name": "Marketing Department",
  "code": "MKT",
  "reference_id": "dept-mkt-001",
  "erp_dimension_id": "DEPT-MKT-001"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
    'X-API-Version' => '1.0.0',
    'X-Api-Key' => 'your-api-key-here',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.ottimate.com/v1/dimensions");
var request = new RestRequest(Method.POST);
request.AddHeader("X-Api-Key", "your-api-key-here");
request.AddHeader("X-API-Version", "1.0.0");
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"ottimate_company_id\": 15196,\n  \"erp_type\": \"Department\",\n  \"ottimate_type\": \"department\",\n  \"name\": \"Marketing Department\",\n  \"code\": \"MKT\",\n  \"reference_id\": \"dept-mkt-001\",\n  \"erp_dimension_id\": \"DEPT-MKT-001\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-Api-Key": "your-api-key-here",
  "X-API-Version": "1.0.0",
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "ottimate_company_id": 15196,
  "erp_type": "Department",
  "ottimate_type": "department",
  "name": "Marketing Department",
  "code": "MKT",
  "reference_id": "dept-mkt-001",
  "erp_dimension_id": "DEPT-MKT-001"
] as [String : Any]

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

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