Create Contact Us
About
The createContactUs mutation allows customers to submit a contact form enquiry to the store. Use this mutation to:
- Submit customer enquiries from the storefront contact page
- Send support requests to the store team
- Allow guests (unauthenticated users) to reach out without an account
- Collect customer contact details alongside their message
- Track form submissions using
clientMutationId - Integrate contact forms in custom storefronts or mobile apps
This mutation does not require authentication — it is available to all visitors.
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
input | createContactUsInput! | ✅ Yes | Input object containing all contact form fields. |
Input Fields (createContactUsInput)
| Field | Type | Required | Description |
|---|---|---|---|
name | String! | ✅ Yes | Full name of the person submitting the enquiry. |
email | String! | ✅ Yes | Email address to reply to. Must be a valid email format. |
contact | String! | ✅ Yes | Contact phone number (e.g. +1234567890). |
message | String! | ✅ Yes | The enquiry or message body. |
clientMutationId | String | ❌ No | Optional client-side identifier for tracking the mutation request. |
Possible Returns
| Field | Type | Description |
|---|---|---|
contactUs.success | Boolean! | true if the contact form was submitted successfully. |
contactUs.message | String! | Human-readable confirmation or error message returned by the server. |
clientMutationId | String | Echoed back from the input if provided; useful for client-side request tracking. |
Use Cases
1. Storefront Contact Page
Trigger this mutation when a customer submits the contact form on /contact-us, then display the response message as a success or error notification.
2. Guest Enquiries
Since no authentication is required, use this mutation for anonymous visitors who want to reach out without creating an account.
3. Mobile App Contact Form
Integrate into a React Native or Flutter app to allow users to send support messages directly from within the app.
4. Track Submissions Client-Side
Pass a unique clientMutationId (e.g. a UUID) to correlate the GraphQL response with the originating form submission in your frontend state.
5. Headless Storefronts
Use in any headless commerce setup to power the contact form without relying on Bagisto's default frontend templates.
Best Practices
- Validate on the client first — Check email format and non-empty fields before calling the mutation to reduce unnecessary API calls
- Always check
success— Do not rely solely on the absence of errors; always readcontactUs.successto confirm submission - Display
messageto the user — Show the server's responsemessageas feedback so users know whether their enquiry was received - Prevent duplicate submissions — Disable the submit button after a successful response to avoid repeated submissions
- Rate limit on the server — Ensure your Bagisto instance has rate limiting configured to protect this endpoint from abuse
- Use
clientMutationIdfor tracking — Pass a unique ID per submission if you need to correlate requests in analytics or error monitoring
Related Resources
- Customer Registration - Register a new customer account
- Customer Login - Authenticate a customer
- Shop API Overview - Overview of all Shop API resources
- Best Practices - GraphQL API best practices

