---
schema_version: "1"
id: e0be61c1b9b34421c82885aed4e267d524f2d52cbb1f19f1b024b21eecd4f373
title: AddObjectArrayItem()
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/marketing-cloud/ampscript/references/api/mc-ampscript-reference-api-add-object-array.md
canonical_url: https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-api/mc-ampscript-reference-api-add-object-array.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 698adb1ae3d9ea49e2a657cabd94a727627a2a854156bce661a7a9f8cdf9f456
products:
  - AMPscript for Marketing Cloud
  - Marketing Cloud
---
# AddObjectArrayItem()

Adds an object to an array in a Marketing Cloud Engagement API object.

## Availability

<table>
  <tr>
    <td>Marketing Cloud Engagement</td>
    <td>✅ Yes</td>
  </tr>
  <tr>
    <td>Marketing Cloud Next</td>
    <td>❌ No</td>
  </tr>
</table>

## Syntax

```
AddObjectArrayItem(apiObject,
                   arrayProperty,
                   itemToAdd)
```

The `AddObjectArrayItem()` function has three parameters:

- `apiObject` (API Object): Required. The API object that contains the array that you want to modify.
- `arrayProperty` (string): Required. The array property to receive the new item.
- `itemToAdd` (string): Required. The item to add to the array.

## Usage

This example adds the attribute `myNewAttribute` to the `Attributes` array on the `mySubscriber` API object.

```
%%[
  AddObjectArrayItem(@mySubscriber,'Attribute',@myNewAttribute)
]%%
```
