> 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

# GetAttachment

# Package: attachments

# Namespace: ContactAttachmentsServiceV4

# Method link: https://dev.wix.com/docs/api-reference/crm/members-contacts/contacts/attachments/attachment-v4/get-attachment?apiView=SDK.md

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

## Introduction

Retrieves the specified attachment for the specified contact.

---

## REST API

### Schema

```
 Method: getAttachment
 Description: Retrieves the specified attachment for the specified contact.
 URL: https://www.wixapis.com/contacts/v4/attachments/{contactId}/{attachmentId}
 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, attachmentId
 Method parameters: 
   param name: attachmentId | type:   none | required: true 
   param name: contactId | type:   none | required: true 
 Return type: GetAttachmentResponse
  - name: attachment | type: ContactAttachment | description: The requested attachment.  
     - 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.


```

### Examples

### GetAttachment
```curl
~~~cURL
curl -X GET \
   'https://www.wixapis.com/contacts/v4/attachments/513c1bfc-61b6-427d-a7f8-ceeedb1eb763/1e7efe60-355a-11eb-b032-19d0ca8630af' \
   -H 'Authorization: <AUTH>'
~~~
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.crm.attachments.getAttachment(identifiers)
 Description: Retrieves the specified attachment for the specified contact.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  identifiers.contactId, identifiers.attachmentId, identifiers
 Method parameters: 
   param name: identifiers | type: GetAttachmentIdentifiers  none | required: true 
        - name: contactId | type: string | description: Contact GUID for the attachment to retrieve. | required: true | validation: format GUID
        - name: attachmentId | type: string | description: Attachment GUID to retrieve. | required: true | validation: format GUID
 Return type: PROMISE<ContactAttachment>
  - 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.


```

### Examples

### getAttachment
```javascript
import { attachments } from '@wix/crm';

async function getAttachment(identifiers) {
  const response = await attachments.getAttachment(identifiers);
};
```

### getAttachment (with elevated permissions)
```javascript
import { attachments } from '@wix/crm';
import { auth } from '@wix/essentials';

async function myGetAttachmentMethod(identifiers) {
  const elevatedGetAttachment = auth.elevate(attachments.getAttachment);
  const response = await elevatedGetAttachment(identifiers);
}
```

### getAttachment (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 getAttachment(identifiers) {
  const response = await myWixClient.attachments.getAttachment(identifiers);
};
```

---