> 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`). > - 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.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. - name: width | type: integer | description: Original image width. - name: altText | type: string | description: Image alt text. Optional. - name: urlExpirationDate | type: string | description: Image URL expiration date when relevant. - 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. - name: id | type: string | description: Attachment GUID. - name: previewImage | type: Image | description: Details of the preview image reduced size when the attachment is of type `IMAGE`. - name: fileName | type: string | description: Name of the attachment file. - 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). - name: attachmentType | type: AttachmentType | description: Type of the attachment. - 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: ' ~~~ ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.attachments.ContactAttachmentsServiceV4.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 - name: attachmentId | type: string | description: Attachment GUID to retrieve. | required: true Return type: PROMISE - 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. - name: previewImage | type: string | description: Details of the preview image reduced size when the attachment is of type `IMAGE`. - name: fileName | type: string | description: Name of the attachment file. - 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). - name: attachmentType | type: AttachmentType | description: Type of the attachment. - 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-hosted) Self-hosted 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); }; ``` ---