# Stock transfer numbering

When [stock transfer](/data-models.md#stocktransfer) is created, the `documentNumber` field is generated by server, based on [stock transfer numbering](/data-models.md#stocktransfernumbering) settings. API methods listed below provides way to modify numbering settings.

## API methods

## Get stock transfer numberings

<mark style="color:blue;">`GET`</mark> `http://{server-address}/stocktransfernumberings`

Returns all stock transfer numberings that matches query parameters. Result is of type [`QueryResult<StockTransferNumbering>`](/data-models.md#queryresult).

#### Query Parameters

| Name     | Type              | Description                                                                                                              |
| -------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------ |
| id       | string            | Supports NData syntax.                                                                                                   |
| isActive | bool              | Supports NData syntax.                                                                                                   |
| $skip    | int               | Pagination property. Describing number of records to skip from beginning of result collection.                           |
| $take    | int               | Pagination property. Maximum count of items to be returned.                                                              |
| $sort    | string\[]         | <p>Comma separated list of property names. Please see NData syntax.<br></p>                                              |
| $count   | bool              | If set to `true`, response will not contain `items` collection. Use to get resource count, not the resources themselves. |
| type     | StockTransferType | Supports NData syntax.                                                                                                   |

#### Headers

| Name                                            | Type   | Description                                    |
| ----------------------------------------------- | ------ | ---------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | Authorization header with authorization token. |

{% tabs %}
{% tab title="200: OK Successful response" %}

```javascript
{
    "items":
    [
        {
            "id": "59919dc4c5960398d3774162",
            "isActive": true,
            "type": "Outcome",
            "format": "V-{yyyy}{MM}{i4}",
            "repeat": true,
            "numberings":
            [
                {
                    "isActive": true,
                    "createdAt": "2023-01-01T00:00:00Z",
                    "startAt": "2023-01-01T00:00:00Z",
                    "period":
                    {
                        "unit": "Month",
                        "amount": 1
                    },
                    "currentNumber": 1
                }
            ],
            "_v": 1
        },
        {
            "id": "59919dcac5960398d3774163",
            "isActive": true,
            "type": "Transfer",
            "format": "T-{yyyy}{MM}{i4}",
            "repeat": true,
            "numberings":
            [
                {
                    "isActive": true,
                    "createdAt": "2023-01-01T00:00:00Z",
                    "startAt": "2023-01-01T00:00:00Z",
                    "period":
                    {
                        "unit": "Month",
                        "amount": 1
                    },
                    "currentNumber": 1
                }
            ],
            "_v": 1
        },
        {
            "id": "59919e02c5960398d3774165",
            "isActive": true,
            "type": "Correction",
            "format": "K-{yyyy}{MM}{i4}",
            "repeat": true,
            "numberings":
            [
                {
                    "isActive": true,
                    "createdAt": "2023-01-01T00:00:00Z",
                    "startAt": "2023-01-01T00:00:00Z",
                    "period":
                    {
                        "unit": "Month",
                        "amount": 1
                    },
                    "currentNumber": 1
                }
            ],
            "_v": 1
        },
        {
            "id": "59919dd9c5960398d3774164",
            "isActive": true,
            "type": "Invoice",
            "format": "FA-{yyyy}{i4}",
            "repeat": true,
            "numberings":
            [
                {
                    "isActive": true,
                    "createdAt": "2022-01-01T00:00:00Z",
                    "startAt": "2022-01-01T00:00:00Z",
                    "period":
                    {
                        "unit": "Year",
                        "amount": 1
                    },
                    "currentNumber": 12
                },
                {
                    "isActive": true,
                    "createdAt": "2023-01-16T09:01:55.711Z",
                    "startAt": "2023-01-01T00:00:00Z",
                    "period":
                    {
                        "unit": "Year",
                        "amount": 1
                    },
                    "currentNumber": 8
                }
            ],
            "_v": 1
        }
    ],
    "count": 4,
    "totalCount": 4
}
```

{% endtab %}
{% endtabs %}

## Get stock transfer numbering

<mark style="color:blue;">`GET`</mark> `http://{server-address}/stocktransfernumberings/{id}`

Result is of type [StockTransferNumbering](/data-models.md#stocktransfernumbering).

#### Path Parameters

| Name                                 | Type   | Description        |
| ------------------------------------ | ------ | ------------------ |
| id<mark style="color:red;">\*</mark> | string | Unique identifier. |

#### Headers

| Name                                            | Type   | Description                                    |
| ----------------------------------------------- | ------ | ---------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | Authorization header with authorization token. |

{% tabs %}
{% tab title="200: OK Resource found." %}

```javascript
{
    "id": "59919dd9c5960398d3774164",
    "isActive": true,
    "type": "Invoice",
    "format": "FA-{yyyy}{i4}",
    "repeat": true,
    "numberings":
    [
        {
            "isActive": true,
            "createdAt": "2022-01-01T00:00:00Z",
            "startAt": "2022-01-01T00:00:00Z",
            "period":
            {
                "unit": "Year",
                "amount": 1
            },
            "currentNumber": 12
        },
        {
            "isActive": true,
            "createdAt": "2023-01-16T09:01:55.711Z",
            "startAt": "2023-01-01T00:00:00Z",
            "period":
            {
                "unit": "Year",
                "amount": 1
            },
            "currentNumber": 8
        }
    ],
    "_v": 1
}
```

{% endtab %}

{% tab title="404: Not Found Resource is not found." %}

```javascript
{
    "title": "Zdroj nebol nájdený",
    "status": 404
}
```

{% endtab %}
{% endtabs %}

## Create stock transfer numbering

<mark style="color:green;">`POST`</mark> `http://{server-address}/stocktransfernumberings`

Creates new stock transfer numbering. Result is of type [StockTransferNumbering](/data-models.md#stocktransfernumbering).

**Required rights**

Authorized user must have `StockTransferNumberingCreate` [right ](/user-rights.md)assigned.

#### Headers

| Name                                            | Type   | Description                                    |
| ----------------------------------------------- | ------ | ---------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | Authorization header with authorization token. |

#### Request Body

| Name                                     | Type                   | Description     |
| ---------------------------------------- | ---------------------- | --------------- |
| (body)<mark style="color:red;">\*</mark> | StockTransferNumbering | Model to create |

{% tabs %}
{% tab title="201: Created Successfuly created." %}

```javascript
{
    "id": "59919dd9c5960398d3774164",
    "isActive": true,
    "type": "Invoice",
    "format": "FA-{yyyy}{i4}",
    "repeat": true,
    "numberings":
    [
        {
            "isActive": true,
            "createdAt": "2022-01-01T00:00:00Z",
            "startAt": "2022-01-01T00:00:00Z",
            "period":
            {
                "unit": "Year",
                "amount": 1
            },
            "currentNumber": 12
        },
        {
            "isActive": true,
            "createdAt": "2023-01-16T09:01:55.711Z",
            "startAt": "2023-01-01T00:00:00Z",
            "period":
            {
                "unit": "Year",
                "amount": 1
            },
            "currentNumber": 8
        }
    ],
    "_v": 1
}
```

{% endtab %}
{% endtabs %}

## Create or update stock transfer numbering

<mark style="color:orange;">`PUT`</mark> `http://{server-address}/stocktransfernumberings/{id}`

Updates existing or creates new stock transfer numbering. Result is of type [StockTransferNumbering](/data-models.md#stocktransfernumbering).

**Required rights**

Authorized user must have assigned `StockTransferNumberingCreate` or `StockTransferNumberingUpdate` [right](/user-rights.md).

#### Path Parameters

| Name                                 | Type   | Description        |
| ------------------------------------ | ------ | ------------------ |
| id<mark style="color:red;">\*</mark> | string | Unique identifier. |

#### Headers

| Name                                            | Type   | Description                                    |
| ----------------------------------------------- | ------ | ---------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | Authorization header with authorization token. |

#### Request Body

| Name                                     | Type                   | Description                |
| ---------------------------------------- | ---------------------- | -------------------------- |
| (body)<mark style="color:red;">\*</mark> | StockTransferNumbering | Model to create or update. |

{% tabs %}
{% tab title="200: OK Successfuly created or updated." %}

```javascript
{
    "id": "59919dd9c5960398d3774164",
    "isActive": true,
    "type": "Invoice",
    "format": "FA-{yyyy}{i4}",
    "repeat": true,
    "numberings":
    [
        {
            "isActive": true,
            "createdAt": "2022-01-01T00:00:00Z",
            "startAt": "2022-01-01T00:00:00Z",
            "period":
            {
                "unit": "Year",
                "amount": 1
            },
            "currentNumber": 12
        },
        {
            "isActive": true,
            "createdAt": "2023-01-16T09:01:55.711Z",
            "startAt": "2023-01-01T00:00:00Z",
            "period":
            {
                "unit": "Year",
                "amount": 1
            },
            "currentNumber": 8
        }
    ],
    "_v": 1
}
```

{% endtab %}
{% endtabs %}

## Delete stock transfer numbering

<mark style="color:red;">`DELETE`</mark> `http://{server-address}/stocktransfernumberings/{id}`

**Required rights**

Authorized user must have `StockTransferNumberingDelete` [right ](/user-rights.md)assigned.

#### Path Parameters

| Name                                 | Type   | Description        |
| ------------------------------------ | ------ | ------------------ |
| id<mark style="color:red;">\*</mark> | string | Unique identifier. |

#### Headers

| Name                                            | Type   | Description                                    |
| ----------------------------------------------- | ------ | ---------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | Authorization header with authorization token. |

{% tabs %}
{% tab title="200: OK Successfuly deleted." %}

```javascript
{
    "id": "59919dd9c5960398d3774164",
    "isActive": true,
    "type": "Invoice",
    "format": "FA-{yyyy}{i4}",
    "repeat": true,
    "numberings":
    [
        {
            "isActive": true,
            "createdAt": "2022-01-01T00:00:00Z",
            "startAt": "2022-01-01T00:00:00Z",
            "period":
            {
                "unit": "Year",
                "amount": 1
            },
            "currentNumber": 12
        },
        {
            "isActive": true,
            "createdAt": "2023-01-16T09:01:55.711Z",
            "startAt": "2023-01-01T00:00:00Z",
            "period":
            {
                "unit": "Year",
                "amount": 1
            },
            "currentNumber": 8
        }
    ],
    "_v": 1
}
```

{% endtab %}

{% tab title="404: Not Found Given resource was not found." %}

```javascript
{
    "title": "Zdroj nebol nájdený",
    "status": 404
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.portos.sk/api-reference/stock-transfer-numbering.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
