# Create a fixed asset type

Operation ID: `createFixedAssetType`

Group: Accounting › Asset Management › Fixed Asset Types

[Open in the interactive reference](https://docs.api.lensing.ai/lensing/v1/endpoints/createFixedAssetType)

`POST /fixed-asset-types`

Retry-safe: A write that accepts Idempotency-Key: repeating a request with the same key replays the stored answer instead of executing twice.

Creates a fixed asset type, the same as saving a new type on the Fixed Asset Type page in Lensing.

A type needs a name and at least one accounting book. `bookIds` lists the books a fixed asset of this type can be recorded in; an empty array fails with AT_LEAST_ONE_BOOK_REQUIRED, and a book that is not a full book (an adjustment book) with BOOK_NOT_FULL. `defaultUsefulLife` is in months. `groupId` and `defaultUsefulLife` are optional: leave `groupId` out, or send it as an empty string, for an ungrouped type.

A new type is not yet usable for depreciating fixed assets: a depreciation policy of the book must also have a rule for it, which is set up on the depreciation policy.

Type names are not unique: creating a type with the name of an existing one creates a second type. A caller that must not create duplicates filters `name` on GET fixed-asset-types first.

The response contains only the new type's id. Read the type with GET fixed-asset-types/:id.

Every error code below is returned with HTTP status 400; branch on the code. Only the fields below are accepted: a body with any other field, `id` or `active` included, is refused with HTTP 400 'Invalid input' before any code is raised, so that response carries no code; its diagnostics name the unexpected property.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Api-Version` | header | string · v1 | yes | The API version this request targets, named by its public identifier. Required on every request; omitting it, or naming a version this company does not have, is answered with 400. This document describes version `v1`. |
| `Idempotency-Key` | header | string | no | An opaque caller-chosen string (1-255 characters) that makes this request safe to retry. Repeating the same key with an identical request body replays the original response instead of re-executing - but only once that original request succeeded; a failed attempt re-executes on retry. Repeating the key with a different body is answered with 422. A key still in flight is answered with 409 - as is a key whose original request was interrupted before it finished, for a few minutes afterwards, until that attempt is presumed dead. A completed response stays replayable for 24 hours. The key is scoped to the caller, not to the action: reusing it for a different action is answered with 409 or 422 rather than treated independently. On read actions this header is ignored. On write actions that cannot offer the guarantee it is answered with `400 IDEMPOTENCY_NOT_SUPPORTED` rather than silently ignored. |

## Request body

Required, `application/json`: createFixedAssetTypeInput.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | yes | Display name of the fixed asset type, e.g. 'Machinery'. Leading and trailing spaces are removed; must not be blank. Not required to be unique. Example: `"Machinery"`. |
| `groupId` | string | no | Platform id (a UUID) of the FixedAssetTypeGroup the type belongs to — the groupId GET fixed-asset-types/:id returns. Omit, or send an empty string, for an ungrouped type. Example: `"2e8c14a9-6b73-4f52-9d01-8a3f7e0c5b26"`. |
| `defaultUsefulLife` | number | no | Default useful life, in months, that a depreciation policy rule for this type is pre-filled with. A whole number from 1 to 2147483647. Omit for no default. Example: `60`. |
| `bookIds` | array<string> | yes | Platform ids (UUIDs) of the accounting books the type is in. See id on GET accounting/books/:id. At least one, and full books only (not adjustment books). A book sent twice counts once. Example: `["4a1d7c52-93e8-4f06-b2c1-7e5d08a39f64"]`. |

```json
{
  "name": "Machinery",
  "bookIds": [
    "4a1d7c52-93e8-4f06-b2c1-7e5d08a39f64"
  ]
}
```

## Response

`200` Success

Under `data` (createFixedAssetTypeOutput):

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes | Platform id (a UUID) of the created fixed asset type. Example: `"7b2f9d13-4c68-4e51-a0d7-6f39c58e2b4a"`. |

```json
{
  "data": {
    "id": "7b2f9d13-4c68-4e51-a0d7-6f39c58e2b4a"
  },
  "diagnostics": [
    {
      "code": "<code>",
      "message": "<message>",
      "severity": "error",
      "path": [
        "<path>"
      ],
      "details": "<details>"
    }
  ]
}
```

## Response headers

- `Idempotency-Replayed` — Present and `true` only when this response replays a previously stored one for the same Idempotency-Key, rather than reflecting a live execution. Absent on a live response - never sent as `false`.

## Errors

| Code | Status |
| --- | --- |
| `GROUP_NOT_FOUND` | 400 |
| `BOOK_NOT_FOUND` | 400 |
| `BOOK_NOT_FULL` | 400 |
| `AT_LEAST_ONE_BOOK_REQUIRED` | 400 |
| `INVALID_FIELD_VALUE` | 400 |
| `FIELD_REQUIRED` | 400 |
| `IDEMPOTENCY_KEY_CONFLICT` | 409 |
| `IDEMPOTENCY_PAYLOAD_MISMATCH` | 422 |

## Statuses

- `400` — Invalid request or business failure. Codes: GROUP_NOT_FOUND, BOOK_NOT_FOUND, BOOK_NOT_FULL, AT_LEAST_ONE_BOOK_REQUIRED, INVALID_FIELD_VALUE, FIELD_REQUIRED
- `401` — The request carries no valid access token.
- `403` — Not authorized
- `404` — Not found
- `409` — The Idempotency-Key is still being processed by another request.
- `422` — The Idempotency-Key was already used with a different request payload.
- `429` — Too many requests from this client address. The response has no body and no `Retry-After` header.
- `500` — Internal server error
