# Update a project

Canonical page: https://docs.ovok.com/slim-apis/project/update-a-project

| Method | Path |
| --- | --- |
| `PUT` | `/v1/slim/project/:id` |

[Authentication](/authentication) · [Access policies](/access-policies)

Updates a project's name, address, contact and settings, and returns the updated project. Use it to edit your project or one of its child projects.

**Auth:** Bearer token of a project admin (`ProjectMembership.admin`).
**Scope:** The project in the path. It must be the caller's project (from the token) or a direct child of it.

## Request [#request]

### Path parameters [#path-parameters]

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string (uuid)` | Yes | Project id. Your own project or a direct child of it. |

### Body [#body]

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | `string` | Yes | Project name. At least 1 character. |
| `id` | `string (uuid)` | No | Ignored. |
| `extension` | `any` | No | Ignored. |
| `address` | `object[]` | No | Postal addresses. Omit to have none. |
| `address[].use` | `"work"` \| `"temp"` \| `"old"` \| `"billing"` | No | Purpose of the address. |
| `address[].type` | `"postal"` \| `"physical"` \| `"both"` | No | Kind of address. |
| `address[].text` | `string` | No | The address as one text. |
| `address[].line` | `string[]` | No | Street lines. Each is a non-empty string. |
| `address[].city` | `string` | No | City. |
| `address[].district` | `string` | No | District. |
| `address[].state` | `string` | No | State. |
| `address[].postalCode` | `string` | No | Postal code. |
| `address[].country` | `string` | No | Country. |
| `contact` | `object[]` | No | Contact persons. Omit to have none. |
| `contact[].telecom` | `object[]` | No | Ways to reach the contact. |
| `contact[].telecom[].system` | `"email"` \| `"phone"` \| `"fax"` \| `"pager"` \| `"url"` \| `"sms"` \| `"other"` | No | Kind of contact point. |
| `contact[].telecom[].use` | `"work"` \| `"temp"` \| `"old"` \| `"mobile"` | No | Purpose of the contact point. |
| `contact[].telecom[].value` | `string` | No | The email address, phone number or URL. |
| `contact[].name` | `object` | No | The contact's name. |
| `contact[].name.use` | `"temp"` \| `"old"` \| `"official"` \| `"usual"` \| `"nickname"` \| `"anonymous"` \| `"maiden"` | No | Kind of name. |
| `contact[].name.prefix` | `string[]` | No | Name prefixes. |
| `contact[].name.given` | `string[]` | No | Given names. |
| `contact[].name.family` | `string` | No | Family name. |
| `contact[].name.suffix` | `string[]` | No | Name suffixes. |
| `contact[].address` | `object` | No | The contact's address, with the same fields as `address[]`. |
| `settings` | `object` | No | Project settings. |
| `settings.timeZone` | `string` | No | Time zone name, such as `Europe/Berlin`. Default `Europe/Berlin`. |
| `settings.trendsPeriod` | `object` | No | The daily window that trends cover. Omit to use the default. |
| `settings.trendsPeriod.start` | `string` | Yes, with `settings.trendsPeriod` | Start time as `HH:MM:SS`. |
| `settings.trendsPeriod.durationSeconds` | `number` | Yes, with `settings.trendsPeriod` | Length of the window in seconds. 0 or more. |

## Behaviour [#behaviour]

- Sets the project `name` and replaces the organization stored inside the project with one built from `name`, `address`, `contact` and `settings`. This is a full replace, not a merge:
  - an omitted `address` or `contact` clears it;
  - an omitted `settings.timeZone` resets the time zone to `Europe/Berlin`;
  - an omitted `settings.trendsPeriod` removes the stored trends period, so reads fall back to the default.
- `id` and `extension` in the body are ignored. The project comes from the path.
- `settings.trendsPeriod.start` must be `HH:MM:SS`.
- The response has the shape of `GET /v1/slim/project/{id}`.


## Example [#example]

```bash
curl -X PUT 'https://api.sandbox.ovok.com/v1/slim/project/b7a3d915-6e20-4c8f-9a14-3d5f7b9c1e68' \
  -H "Authorization: Bearer ${OVOK_TOKEN}" \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Example project",
    "address": [{ "line": ["Hauptstrasse 1"], "city": "Berlin", "postalCode": "10115", "country": "DE" }],
    "settings": { "timeZone": "Europe/Berlin", "trendsPeriod": { "start": "09:00:00", "durationSeconds": 86400 } }
  }'
```

## Successful response [#successful-response]

`200` — The project was updated successfully.

```json
{
  "resourceType": "Project",
  "id": "b7a3d915-6e20-4c8f-9a14-3d5f7b9c1e68",
  "name": "Example project",
  "address": [{ "line": ["Hauptstrasse 1"], "city": "Berlin", "postalCode": "10115", "country": "DE" }],
  "settings": { "timeZone": "Europe/Berlin", "trendsPeriod": { "start": "09:00:00", "durationSeconds": 86400 } }
}
```

The body is the updated project, as `GET /v1/slim/project/{id}` returns it.

| Field | Type | Description |
| --- | --- | --- |
| `resourceType` | `"Project"` | Always `Project`. |
| `id` | `string (uuid)` | Project id. |
| `name` | `string` | Project name. The project id when the project has no name. |
| `address` | `object[]` | Postal addresses of the project. Left out when there are none. Each entry has the fields of `address[]` in the request: `use`, `type`, `text`, `line`, `city`, `district`, `state`, `postalCode` and `country`. |
| `contact` | `object[]` | Contact persons of the project. Left out when there are none. Each entry has the fields of `contact[]` in the request: `telecom`, `name` and `address`. |
| `settings` | `object` | Project settings. |
| `settings.timeZone` | `string` | Time zone name. `Europe/Berlin` when none is stored. |
| `settings.trendsPeriod` | `object` | The daily window that trends cover. |
| `settings.trendsPeriod.start` | `string` | Start time as `HH:MM:SS`. `09:00:00` when none is stored. |
| `settings.trendsPeriod.durationSeconds` | `number` | Length of the window in seconds. `86400` when none is stored. |

## Errors [#errors]

| Status | Meaning |
| --- | --- |
| [`400`](/errors/malformed-request) | The project is neither the caller's project nor a direct child of it, or it cannot be read. |
| [`401`](/errors/unauthenticated) | The bearer token is missing or invalid, or the session carries no project. |
| [`403`](/errors/forbidden) | The session is not a project admin session. |
| [`404`](/errors/not-found) | No project has this id. |
| [`422`](/errors/validation-failed) | `id` is not a UUID, or the body fails validation. |
