> 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

# GenerateContactImageUploadUrl

# Package: contacts

# Namespace: Contacts

# Method link: https://dev.wix.com/docs/api-reference/crm/members-contacts/contacts/contacts-v5/generate-contact-image-upload-url.md

## Permission Scopes:
Manage Contacts: SCOPE.DC-CONTACTS.MANAGE-CONTACTS

## Introduction

Generates an upload URL to allow external clients to upload a contact image.
To learn how external clients can use the generated upload URL in the response to upload a file,
see the [Upload API](https://dev.wix.com/docs/api-reference/assets/media/media-manager/files/upload-api.md) article.

You can call [Get Contact Image Upload Status](https://dev.wix.com/docs/api-reference/crm/members-contacts/contacts/contacts-v5/get-contact-image-upload-status.md) to query the status of the image upload.

---

## REST API

### Schema

```
 Method: generateContactImageUploadUrl
 Description: Generates an upload URL to allow external clients to upload a contact image. To learn how external clients can use the generated upload URL in the response to upload a file, see the [Upload API](https://dev.wix.com/docs/api-reference/assets/media/media-manager/files/upload-api.md) article.  You can call [Get Contact Image Upload Status](https://dev.wix.com/docs/api-reference/crm/members-contacts/contacts/contacts-v5/get-contact-image-upload-status.md) to query the status of the image upload.
 URL: https://www.wixapis.com/contacts/v5/contacts/{contactId}/image/upload-url
 Method: POST
 Method parameters:
   param name: mimeType | type: mimeType | description: MIME type. Must be one of: `image/png`, `image/jpeg`.  Default: `image/png`  | validation: maxLength 100
 Return type: GenerateContactImageUploadUrlResponse
  - name: uploadUrl | type: string | description: URL to upload the image to.  | validation: format WEB_URL
  - name: imageUploadId | type: string | description: Upload GUID. Pass this GUID to [Get Contact Image Upload Status](https://dev.wix.com/docs/api-reference/crm/members-contacts/contacts/contacts-v5/get-contact-image-upload-status.md) to check the status of the upload.  | validation: format GUID

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: INVALID_MIME_TYPE | Description: Invalid image MIME type.


```

### Examples

### Generate contact image upload URL
Generates an upload URL for a contact image.

```curl
curl -X POST \
'https://www.wixapis.com/contacts/v5/contacts/a64d222b-d16e-4f68-9926-064aee9f47a2/image/upload-url' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json' \
-d '{
  "mimeType": "image/png"
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.crm.contactsV5.generateContactImageUploadUrl(contactId, options)
 Description: Generates an upload URL to allow external clients to upload a contact image. To learn how external clients can use the generated upload URL in the response to upload a file, see the [Upload API](https://dev.wix.com/docs/api-reference/assets/media/media-manager/files/upload-api.md) article.  You can call [Get Contact Image Upload Status](https://dev.wix.com/docs/api-reference/crm/members-contacts/contacts/contacts-v5/get-contact-image-upload-status.md) to query the status of the image upload.
 # 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: GUID of the contact to generate an image upload URL for. | required: true | validation: format GUID
   param name: options | type: GenerateContactImageUploadUrlOptions  none  
        - name: mimeType | type: string | description: MIME type. Must be one of: `image/png`, `image/jpeg`.  Default: `image/png`  | validation: maxLength 100
 Return type: PROMISE<GenerateContactImageUploadUrlResponse>
  - name: uploadUrl | type: string | description: URL to upload the image to.  | validation: format WEB_URL
  - name: imageUploadId | type: string | description: Upload GUID. Pass this GUID to [Get Contact Image Upload Status](https://dev.wix.com/docs/api-reference/crm/members-contacts/contacts/contacts-v5/get-contact-image-upload-status.md) to check the status of the upload.  | validation: format GUID

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: INVALID_MIME_TYPE | Description: Invalid image MIME type.


```

### Examples

### Generate a contact image upload URL
```javascript
import { contactsV5 } from "@wix/crm";

const contactId = "085ccffa-6686-427f-a310-9b5e3058ebbc";

const options = {
  mimeType: "image/png",
};

async function generateContactImageUploadUrl() {
  const response = await contactsV5.generateContactImageUploadUrl(contactId, options);
}

/* Promise resolves to:
 * {
 *   "uploadUrl": "https://upload.wixmp.com/upload/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
 *   "imageUploadId": "4d4e448c-6f04-4b12-aeab-b9879ec7943c"
 * }
 */

```

### generateContactImageUploadUrl (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 { contactsV5 } from '@wix/crm';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

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


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

---