> This page is for version v1 (default).
> For other versions, use one of these documentation indexes:
> - v1 (default): https://developers.outpave.com/v1/llms.txt
> - v2: https://developers.outpave.com/v2/llms.txt

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

# Create allocations

POST https://api.outpave.com/api/v1/allocations
Content-Type: application/json

Create one or more allocations in a single request. Each entry must
include either `sourceId` or `id`. For sub-class entries
(`subClass: true`), also provide `parentRef.value` or `parentId`.
Requires **Admin** role and the allocations feature on your company's plan.


Reference: https://developers.outpave.com/api-reference/company-api/allocations/post-api-v-1-allocations

## Authentication

- `Authorization` header (bearer token, required) — A short-lived access token from `POST /api/v1/access-token` (30 minutes by default). Send as `Authorization: Bearer <jwt>`.

## Request

### Body (application/json)

This endpoint expects an object.

- `allocations` (list of AllocationEntry, required)

## Response

### 200

Allocations created.

- `allocations` (list of Allocation, required)

## Errors

### 400 Bad Request Error

The request was malformed or failed validation.

- `error` (string, required) — A short, human-readable error message.
- `details` (list of string, optional) — Additional error details (returned on validation failures).

### 401 Unauthorized Error

The credential is missing, invalid, expired, or doesn't have permission for this endpoint.

- `error` (string, required) — A short, human-readable error message.
- `details` (list of string, optional) — Additional error details (returned on validation failures).

### 403 Forbidden Error

The credential is valid but doesn't have permission to access this resource, or your plan does not include API access or the feature.

- `error` (string, required) — A short, human-readable error message.
- `details` (list of string, optional) — Additional error details (returned on validation failures).

### 429 Too Many Requests Error

You've exceeded the rate limit for your API key. Check the `RateLimit-*` headers for your remaining quota.

- `error` (string, required) — A short, human-readable error message.
- `details` (list of string, optional) — Additional error details (returned on validation failures).

### 500 Internal Server Error

An unexpected server error occurred. Retry the request; if the problem persists, contact support.

- `error` (string, required) — A short, human-readable error message.
- `details` (list of string, optional) — Additional error details (returned on validation failures).

## Types

### AllocationEntry

Allocation payload used by both create and update. Provide either `sourceId` or `id`. When `subClass` is `true`, also provide `parentRef.value` or `parentId`.

- `type` (string, required) — The allocation type (e.g. `ClassRef`, `DepartmentRef`).
- `name` (string, optional) — The allocation's display name.
- `fullyQualifiedName` (string, optional) — The fully qualified name, including any parent hierarchy.
- `subClass` (boolean, optional) — Whether this is a sub-class of a parent allocation. When `true`, `parentRef.value` or `parentId` must be provided.
- `parentRef` (AllocationEntryParentRef, optional, nullable) — A reference to the parent allocation by external identifier.
- `parentId` (string, optional) — The parent allocation's unique identifier.
- `sourceId` (string, optional) — The allocation's identifier in your source system (e.g. QuickBooks). One of `sourceId` or `id` is required.
- `id` (string, optional) — The allocation's unique identifier. One of `sourceId` or `id` is required.
- `active` (boolean, optional) — Whether the allocation is active.

### Allocation

An allocation.

- `id` (string, optional) — The allocation's unique identifier.
- `companyId` (string, optional) — The unique identifier of the company that owns the allocation.
- `type` (string, optional) — The allocation type (e.g. `ClassRef`, `DepartmentRef`).
- `typeName` (string, optional) — A human-readable name for the allocation type.
- `name` (string, optional) — The allocation's display name.
- `fullyQualifiedName` (string, optional) — The fully qualified name, including any parent hierarchy.
- `sourceId` (string, optional) — The allocation's identifier in your source system (e.g. QuickBooks).
- `parentId` (string, optional, nullable) — The parent allocation's unique identifier, if any.
- `active` (boolean, optional) — Whether the allocation is currently active.
- `status` (enum, optional) — The allocation's current status.
  - Allowed values: `ACTIVE`, `INACTIVE`
- `createdAt` (long, optional) — Unix timestamp (milliseconds) when the allocation was created.
- `updatedAt` (long, optional) — Unix timestamp (milliseconds) when the allocation was last updated.

### AllocationEntryParentRef

A reference to the parent allocation by external identifier.

- `value` (string, optional) — The parent allocation's external identifier.

## Examples

**Request**

```json
{
  "allocations": [
    {
      "type": "ClassRef",
      "name": "Marketing",
      "sourceId": "qb-class-1001",
      "active": true
    }
  ]
}
```

**Response**

```json
{
  "allocations": [
    {
      "id": "string",
      "companyId": "string",
      "type": "ClassRef",
      "typeName": "Class",
      "name": "Marketing",
      "fullyQualifiedName": "Marketing",
      "sourceId": "qb-class-1001",
      "parentId": "string",
      "active": true,
      "status": "ACTIVE",
      "createdAt": 1,
      "updatedAt": 1
    }
  ]
}
```

**SDK Code**

```python minimal
import requests

url = "https://api.outpave.com/api/v1/allocations"

payload = { "allocations": [
        {
            "type": "ClassRef",
            "name": "Marketing",
            "sourceId": "qb-class-1001",
            "active": True
        }
    ] }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript minimal
const url = 'https://api.outpave.com/api/v1/allocations';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"allocations":[{"type":"ClassRef","name":"Marketing","sourceId":"qb-class-1001","active":true}]}'
};

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

```go minimal
package main

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

func main() {

	url := "https://api.outpave.com/api/v1/allocations"

	payload := strings.NewReader("{\n  \"allocations\": [\n    {\n      \"type\": \"ClassRef\",\n      \"name\": \"Marketing\",\n      \"sourceId\": \"qb-class-1001\",\n      \"active\": true\n    }\n  ]\n}")

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

	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 minimal
require 'uri'
require 'net/http'

url = URI("https://api.outpave.com/api/v1/allocations")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"allocations\": [\n    {\n      \"type\": \"ClassRef\",\n      \"name\": \"Marketing\",\n      \"sourceId\": \"qb-class-1001\",\n      \"active\": true\n    }\n  ]\n}"

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

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

HttpResponse<String> response = Unirest.post("https://api.outpave.com/api/v1/allocations")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"allocations\": [\n    {\n      \"type\": \"ClassRef\",\n      \"name\": \"Marketing\",\n      \"sourceId\": \"qb-class-1001\",\n      \"active\": true\n    }\n  ]\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.outpave.com/api/v1/allocations', [
  'body' => '{
  "allocations": [
    {
      "type": "ClassRef",
      "name": "Marketing",
      "sourceId": "qb-class-1001",
      "active": true
    }
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp minimal
using RestSharp;

var client = new RestClient("https://api.outpave.com/api/v1/allocations");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"allocations\": [\n    {\n      \"type\": \"ClassRef\",\n      \"name\": \"Marketing\",\n      \"sourceId\": \"qb-class-1001\",\n      \"active\": true\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift minimal
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["allocations": [
    [
      "type": "ClassRef",
      "name": "Marketing",
      "sourceId": "qb-class-1001",
      "active": true
    ]
  ]] as [String : Any]

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

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