Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/pages/graphql/schema/uploads/mutations/initiate-upload.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@ Use the `upload_url` from the response to PUT the file directly to S3. See [Uplo

After the file is successfully uploaded, use the [`finishUpload` mutation](finish-upload.md) to complete the upload process.

## reCAPTCHA validation

You can call the `initiateUpload` for many reasons, for example to attach an image to a return. To limit automated upload requests, merchants can require Google reCAPTCHA validation on this mutation. This setting is disabled by default. To enable it, set [**Enable for Presigned Upload**](https://experienceleague.adobe.com/en/docs/commerce-admin/config/security/google-recaptcha-storefront) in **Stores** > **Configuration** > **Security** > **Google reCAPTCHA Storefront** > **Storefront**.

When working with guest shoppers, call the `initiateUpload` mutation without a customer token.

When the setting is enabled, each `initiateUpload` request must include a valid reCAPTCHA token in the `X-ReCaptcha` HTTP header:

```text
X-ReCaptcha: <reCAPTCHA-token>
```

If the token is missing or invalid, the request fails and Commerce does not issue a presigned URL. The `finishUpload` mutation does not require a reCAPTCHA token because it can only complete an upload that `initiateUpload` started.

For more information about reCAPTCHA headers, see [Protected mutations](../../../usage/protected-mutations.md).

## Syntax

```graphql
Expand Down
1 change: 1 addition & 0 deletions src/pages/graphql/usage/protected-mutations.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ The following table lists the forms and mutations that can be configured to requ
| Enable for Checkout/Placing Order | `setPaymentMethodOnCart`, `setPaymentMethodAndPlaceOrder` |
| Enable for Coupon Codes | `applyCouponToCart` |
| Enable for Resend Confirmation Email | `resendConfirmationEmail` |
| Enable for Presigned Upload | [SaaS only](https://experienceleague.adobe.com/en/docs/commerce/user-guides/product-solutions) `initiateUpload` |

## Related topics

Expand Down
Loading