# Update a position

Operation ID: `updatePsaPosition`

Group: PSA › Positions

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

`PATCH /psa/positions/{id}`

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

Updates one position (project role). Fields you leave out keep their stored value; null clears a reference or hoursBudget. The result is checked as a whole before anything is written, and every problem found is returned.

As in the Roles tab: an invoiced position cannot be changed; making a position non-billable clears its sales order links, and is rejected while its members are assigned to client-billable hours activities; product line links an older position may still carry are cleared. Rates are hourly and always stored in the project currency. A new sales order line supplies the bill rate and unit, and fills in what you leave out: the name, the cost rate, the HR position and the skill level, as on POST psa/positions. Product details are never taken from the request.

Every identifier is a UUID, the same one the matching GET endpoint returns.

## 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. |
| `id` | path | string | yes | The unique identifier of the position to update. Updating needs edit permission on its project. Example: `"5c1e0a7d-3b92-4f64-8e21-d07a9b4c6f15"`. |

## Request body

Required, `application/json`: updatePsaPositionInput.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | no | The display name. Must not be blank. When omitted with a new sales order line, it is derived from the line as on POST psa/positions. |
| `description` | string | no | A free-form description of the position's responsibilities. |
| `billable` | boolean | no | Whether work in this position is billable to the customer. Internal and NonBillable projects cannot have billable positions. Making a position non-billable clears its sales order links. |
| `unitOfMeasure` | string | no | The billing unit: 'hour' or 'day'. With a sales order line it must equal that line's (or its rate card entry's) unit, or be left out. One of: `"hour"`, `"day"`. |
| `hourlyBillRate` | decimal | no | The bill rate per hour, non-negative. Not allowed with a sales order line, which supplies the rate. A non-billable position takes only 0. Example: `"195.00"`. |
| `hourlyBillRateCurrency` | string | no | The currency of hourlyBillRate. Format ISO 4217. Must be the project currency. |
| `hourlyCostRate` | decimal | no | The cost rate per hour, non-negative. |
| `hourlyCostRateCurrency` | string | no | The currency of hourlyCostRate. Format ISO 4217. Must be the project currency. |
| `hoursBudget` | decimal \| null | no | The budgeted hours, a non-negative count of hours. null clears it. Example: `"400"`. |
| `salesOrderProductLineId` | string \| null | no | The sales order product line to bill, as on GET psa/positions. Billable positions only; a billable time line of a sales order under the project's sales arrangement that no other project of that arrangement uses. null clears it. |
| `salesOrderProductLineRateCardEntryId` | string \| null | no | The rate card entry of the sales order line, as on GET psa/positions. Required when that line has rate card entries. null clears it. |
| `hrPositionId` | string \| null | no | The HR position this project role maps to. See id on GET people/positions/:id. null clears it. When omitted with a new sales order line, it is taken from the role catalog of the line's product line. |
| `skillLevelId` | string \| null | no | The skill level (position seniority) this project role maps to, as skillLevelId on GET psa/positions. null clears it. When omitted with a new sales order line, it is taken from the role catalog of the line's product line. |

```json
{}
```

## Response

`200` Success

```json
{
  "data": {},
  "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 |
| --- | --- |
| `NOT_FOUND` | 400 |
| `FORBIDDEN` | 400 |
| `POSITION_INVOICED` | 400 |
| `PROJECT_SETTINGS_MISSING` | 400 |
| `REFERENCE_NOT_FOUND` | 400 |
| `NAME_REQUIRED` | 400 |
| `VALUE_NEGATIVE` | 400 |
| `CURRENCY_MISMATCH` | 400 |
| `BILLING_REFERENCE_NOT_ALLOWED` | 400 |
| `LINE_NOT_BILLABLE_TIME` | 400 |
| `SALES_ORDER_NOT_IN_SALES_ARRANGEMENT` | 400 |
| `RATE_CARD_ENTRY_REQUIRED` | 400 |
| `RATE_CARD_ENTRY_MISMATCH` | 400 |
| `BILL_RATE_REQUIRED` | 400 |
| `BILL_RATE_NOT_ALLOWED` | 400 |
| `UNIT_OF_MEASURE_LOCKED` | 400 |
| `BILLABLE_NOT_ALLOWED` | 400 |
| `SALES_ORDER_USED_BY_OTHER_PROJECT` | 400 |
| `BILLABLE_REQUIRED_BY_ACTIVITIES` | 400 |
| `IDEMPOTENCY_KEY_CONFLICT` | 409 |
| `IDEMPOTENCY_PAYLOAD_MISMATCH` | 422 |

## Statuses

- `400` — Invalid request or business failure. Codes: NOT_FOUND, FORBIDDEN, POSITION_INVOICED, PROJECT_SETTINGS_MISSING, REFERENCE_NOT_FOUND, NAME_REQUIRED, VALUE_NEGATIVE, CURRENCY_MISMATCH, BILLING_REFERENCE_NOT_ALLOWED, LINE_NOT_BILLABLE_TIME, SALES_ORDER_NOT_IN_SALES_ARRANGEMENT, RATE_CARD_ENTRY_REQUIRED, RATE_CARD_ENTRY_MISMATCH, BILL_RATE_REQUIRED, BILL_RATE_NOT_ALLOWED, UNIT_OF_MEASURE_LOCKED, BILLABLE_NOT_ALLOWED, SALES_ORDER_USED_BY_OTHER_PROJECT, BILLABLE_REQUIRED_BY_ACTIVITIES
- `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
