> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# ListAttachments

# Package: attachments

# Namespace: ContactAttachmentsServiceV4

# Method link: https://dev.wix.com/docs/api-reference/crm/members-contacts/contacts/attachments/attachment-v4/list-attachments.md

## Permission Scopes:
Manage Contact Attachments: SCOPE.DC-CONTACTS.MANAGE-CONTACT-ATTACHMENTS

## Introduction

Retrieves a list of attachments associated with a specified contact.

---

## REST API

### Schema

```
 Method: listAttachments
 Description: Retrieves a list of attachments associated with a specified contact.
 URL: https://www.wixapis.com/contacts/v4/attachments/{contactId}
 Method: GET
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  contactId
 Method parameters: 
   param name: contactId | type:   none | required: true 
   param name: paging | type: Paging    
        - name: limit | type: integer | description: Number of items to return.  Default: `100` Max: `100`  | validation: minimum 0, maximum 100, format int32
        - name: offset | type: integer | description: Number of items to skip in the current sort order.  | validation: minimum 0, format int32
 Return type: ListAttachmentsResponse
  - name: attachments | type: array<ContactAttachment> | description: List of attachments for the specified contact.  
     - ONE-OF: 
        - name: image | type: Image | description: Image details when the attachment type is `IMAGE`.  
           - name: id | type: string | description: WixMedia image GUID.  
           - name: url | type: string | description: Image URL.  
           - name: height | type: integer | description: Original image height.  | read-only: true 
           - name: width | type: integer | description: Original image width.  | read-only: true 
           - name: altText | type: string | description: Image alt text. Optional.  
           - name: urlExpirationDate | type: string | description: Image URL expiration date when relevant.  | read-only: true | validation: format date-time
        - name: document | type: Document | description: Document details when the attachment type is `OTHER`.  
           - name: id | type: string | description: WixMedia GUID.  
           - name: url | type: string | description: Document URL.  
           - name: urlExpirationDate | type: string | description: Document URL expiration date when relevant.  | read-only: true | validation: format date-time
     - name: id | type: string | description: Attachment GUID.  | read-only: true | validation: format GUID
     - name: previewImage | type: Image | description: Details of the preview image reduced size when the attachment is of type `IMAGE`.  | read-only: true 
     - name: fileName | type: string | description: Name of the attachment file.  | read-only: true 
     - name: mimeType | type: string | description: Mime type of the attachment. See [supported mime types](https://dev.wix.com/docs/rest/crm/members-contacts/contacts/attachments/attachment-v4/supported-mime-types.md).  | read-only: true 
     - name: attachmentType | type: AttachmentType | description: Type of the attachment.  | read-only: true 
         - enum:
         -     UNKNOWN: Unknown attachment type.
         -     IMAGE: Attachment is an image file.
         -     OTHER: Attachment is a document or any non-image file type.
  - name: metadata | type: PagingMetadata | description: Metadata for the paginated results.  
     - name: count | type: integer | description: Number of items returned in the response.  | validation: format int32
     - name: offset | type: integer | description: Offset that was requested.  | validation: format int32
     - name: total | type: integer | description: Total number of items that match the query.  | validation: format int32
     - name: tooManyToCount | type: boolean | description: Whether the server failed to calculate the `total` field.  


```

### Examples

### ListAttachments
```curl
~~~cURL
curl -X GET \
   'https://www.wixapis.com/contacts/v4/attachments'  --data-binary '{
        "contactId": "513c1bfc-61b6-427d-a7f8-ceeedb1eb763"
    }'  -H 'Content-Type: application/json' -H 'Authorization: <AUTH>'
~~~
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.crm.attachments.listAttachments(contactId, options)
 Description: Retrieves a list of attachments associated with a specified contact.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  contactId
 Method parameters: 
   param name: contactId | type: string | description: Contact GUID for the attachments to be listed. | required: true | validation: format GUID
   param name: options | type: ListAttachmentsOptions  none  
        - name: paging | type: Paging | description: Allow paginating, default: limit = 100 and offset = 0  
           - name: limit | type: integer | description: Number of items to return.  Default: `100` Max: `100`  | validation: minimum 0, maximum 100, format int32
           - name: offset | type: integer | description: Number of items to skip in the current sort order.  | validation: minimum 0, format int32
 Return type: PROMISE<ListAttachmentsResponse>
  - name: attachments | type: array<ContactAttachment> | description: List of attachments for the specified contact.  
     - ONE-OF: 
        - name: image | type: string | description: Image details when the attachment type is `IMAGE`.  
        - name: document | type: string | description: Document details when the attachment type is `OTHER`.  
     - name: _id | type: string | description: Attachment GUID.  | read-only: true | validation: format GUID
     - name: previewImage | type: string | description: Details of the preview image reduced size when the attachment is of type `IMAGE`.  | read-only: true 
     - name: fileName | type: string | description: Name of the attachment file.  | read-only: true 
     - name: mimeType | type: string | description: Mime type of the attachment. See [supported mime types](https://dev.wix.com/docs/rest/crm/members-contacts/contacts/attachments/attachment-v4/supported-mime-types.md).  | read-only: true 
     - name: attachmentType | type: AttachmentType | description: Type of the attachment.  | read-only: true 
         - enum:
         -     UNKNOWN: Unknown attachment type.
         -     IMAGE: Attachment is an image file.
         -     OTHER: Attachment is a document or any non-image file type.
  - name: metadata | type: PagingMetadata | description: Metadata for the paginated results.  
     - name: count | type: integer | description: Number of items returned in the response.  | validation: format int32
     - name: offset | type: integer | description: Offset that was requested.  | validation: format int32
     - name: total | type: integer | description: Total number of items that match the query.  | validation: format int32
     - name: tooManyToCount | type: boolean | description: Whether the server failed to calculate the `total` field.  


```

### Examples

### List contact attachments
```javascript
// @description: Retrieves a list of attachments associated with a specified contact.

import { attachments } from "@wix/crm";

async function listAttachmentsExample() {
  const contactId = "513c1bfc-61b6-427d-a7f8-ceeedb1eb763";
  const response = await attachments.listAttachments(contactId);
  return response;
}

/* Promise resolves to:
 * {
 *   attachments: [
 *     {
 *       _id: string,
 *       mediaItem: { document?: { id, url }, image?: { id, url, height, width } },
 *       fileName: string,
 *       mimeType: string,
 *       attachmentType: string
 *     }
 *   ],
 *   metadata: { count: number, offset: number, total: number }
 * }
 */

```

### listAttachments (self-managed)
Self-managed SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { attachments } from '@wix/crm';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { attachments },
  // Include the auth strategy and host as relevant
});


async function listAttachments(contactId,options) {
  const response = await myWixClient.attachments.listAttachments(contactId,options);
};
```

---