# addressbookObjects.put

Create or replace addressbook object.

Creates or updates a addressbook object from raw text/vcard text or JSContact JSON (RFC 9553).

```ts
openemail.addressbookObjects.put(
  identityId: string,
  addressbookId: string,
  href: string,
  vcard: RawBody,
  options?: AddressbookObjectsPutOptions,
): ApiPromise<PimPutResult>
```

It calls `PUT /identities/{identityId}/addressbooks/{addressbookId}/objects/{href}`: [Create or replace addressbook object](/docs/api/pim/put_AddressbookObjectPut) in the API reference.

## Example

```ts
const pimPutResult = await openemail.addressbookObjects.put(identityId, addressbookId, href, vcard)
```

## Arguments

| Argument | Type | Description |
| --- | --- | --- |
| `identityId` | `string` | Mailbox identity ULID. The path's `{identityId}`. |
| `addressbookId` | `string` | Collection ULID or its name slug. The path's `{addressbookId}`. |
| `href` | `string` | The object's href: its filename segment within the collection (e.g. 1a2b3c.ics). The path's `{href}`. |
| `vcard` | [`RawBody`](/docs/sdks/typescript/calling-methods#raw-bodies) | Raw iCalendar or vCard text. The request's body, as bytes: text, a `Blob`, an `ArrayBuffer` or a `Uint8Array` ([raw bodies](/docs/sdks/typescript/calling-methods#raw-bodies)). |

## Options

The last argument, `options`, a `AddressbookObjectsPutOptions`, takes:

| Option | Type | Sent as | Description |
| --- | --- | --- | --- |
| `ifMatch` | `string` | header `if-match` | Match target ETag for optimistic concurrency |
| `ifScheduleTagMatch` | `string` | header `if-schedule-tag-match` | RFC 6638 §3.2.10.1 — match the target's Schedule-Tag. Unlike the ETag this does not move when an arriving REPLY patches PARTSTAT into the stored copy, so an organizer's client can still write conditionally after its attendees answer. Sent together with If-Match, BOTH must validate |
| `ifNoneMatch` | `string` | header `if-none-match` | Set to '*' to only create if resource does not exist |

Every call also takes `signal`, `timeout`, `retry` and `headers`, which say how that one call is sent ([call options](/docs/sdks/typescript/calling-methods#call-options)).

## Answer

Awaited, it is the API's JSON, [`PimPutResult`](/docs/sdks/typescript/types/pim-put-result). It is an [`ApiPromise`](/docs/sdks/typescript/responses): `.withResponse()` gives the same with the `Response` it came in, for its headers.

## Errors

| Status | What it means |
| --- | --- |
| `400` | empty_body, invalid_href, multiple_uids, unsatisfiable_recurrence (an RRULE no date after DTSTART satisfies), or validation error |
| `401` | unauthorized: the bearer credential is missing, malformed, expired, or revoked. Carries a `WWW-Authenticate: Bearer` challenge |
| `403` | forbidden: read-only grant |
| `404` | No such collection, or mailbox not accessible |
| `409` | uid_conflict: the href holds a different UID, or the UID already lives at another href (conflictHref names it); unsupported_component: the calendar does not accept the object's component |
| `412` | precondition_failed: If-Match/If-None-Match not satisfied |
| `413` | object_too_large (max 1048576 bytes) |
| `503` | scheduling_unavailable: preparation could not complete; no mutation committed. Or temporary_failure: the platform's storage could not answer just now; retry after the Retry-After window. Any operation can answer this. A write that got it may have been applied, so retry it with the same idempotency key where it takes one, or read the state back first (see Transient failures in the API description) |
| `507` | scheduling_backlog_full, too_many_objects (collection or store object cap) or store_full (the store's 268435456-byte total would be exceeded) |

A failed call rejects with a [`RequestError`](/docs/sdks/typescript/errors): its `status`, and its `code`, the API's `error`. Decide on the code: one status covers several.

## Types

It names these types of the API, each on a page of its own: [`PimPutResult`](/docs/sdks/typescript/types/pim-put-result).
