Skip to main content

GraphQL

Overview​

HidePrice Pro adds two queries and two mutations to Magento's GraphQL endpoint, /graphql. They read price requests, create a request and upload a file for it. They do the same as the REST API. Authentication, filters and the phone and file conventions are explained in the Overview.

Operation Type What it does
hidepriceRequest Query Returns one request by its request_id.
hidepriceRequests Query Returns all requests, or those matching a filter, with their count.
hidepriceRequestSubmit Mutation Creates a request and returns it.
hidepriceRequestUpload Mutation Uploads a file and returns its hash.

Authentication​

Every operation needs an admin or integration token whose role or integration includes MageMe_HidePricePro::manage_requests (Sales → HidePrice → Price Requests in the role tree). Send it as Authorization: Bearer <token>. An admin token always works. An integration's access token works only when Magento allows integration tokens as Bearer tokens; GraphQL doesn't accept OAuth 1.0a signed calls in its place. See Overview → Authentication.

A customer token or a call without a token is refused with "The current customer isn't authorized." A token without the resource is refused with "The consumer isn't authorized to access resources."

HidePrice Pro must be turned on for the store of the call (the Store header, or the default store view). Otherwise every operation answers "Module disabled."

Operations​

hidepriceRequest​

Returns one request.

Argument Type Description
request_id Int! The internal ID of the request. Must be greater than 0.

Returns a HidePriceRequest.

query {
hidepriceRequest(request_id: 32) {
request_id
increment_id
customer_email
customer_firstname
customer_lastname
message
created_at
product {
product_id
product_name
product_sku
}
}
}

hidepriceRequests​

Returns the requests that match a filter, or all requests without one.

Argument Type Description
filter String A JSON object of column names and values, as a string. The rules are the same as for the REST list route.

Returns a HidePriceRequests object: items and count, the number of items returned.

query {
hidepriceRequests(filter: "{\"customer_email\": \"ingrid.dahl@fjordbygg.example\"}") {
items {
request_id
customer_email
is_read
created_at
product {
product_id
product_sku
}
}
count
}
}

hidepriceRequestSubmit​

Creates a request in the store view of the call and returns it. The emails go out with the module's cron job, as for the storefront form.

Argument Type Description
email String! Customer email address. Must be a valid address.
product_id Int! ID of the requested product. The request takes the product's SKU and name from the catalog.
firstname, lastname String Customer name.
phone String Phone number, for example +4791234567. Required when the phone field is required in Settings: Phone Number.
message String Customer message.
custom_field_1, custom_field_2, custom_field_3 String Field values. Required when that field is required in Settings: Custom Field 1, 2 and 3.
product_sku, product_name String Optional. Used only when no product with product_id is found; then they are stored as you send them.
product_options String The chosen product options as a JSON string. See Product options. Anything that isn't valid JSON is refused.
attachment String Hashes from hidepriceRequestUpload, separated by ;.

Returns a HidePriceRequest.

mutation {
hidepriceRequestSubmit(
email: "ingrid.dahl@fjordbygg.example",
firstname: "Ingrid",
lastname: "Dahl",
phone: "+4791234567",
message: "Please send a price for 8 meeting tables for our new office.",
product_id: 2120
) {
request_id
increment_id
customer_email
created_at
}
}

Product options​

product_options is the buy request as a JSON object, the same data the product page sends when the customer chooses options:

  • For a configurable product, the chosen attribute and option IDs: {"super_attribute": {"183": "215"}, "qty": 1}. The request stores the SKU of the chosen variant. Price Requests shows the product as "Lobby Lounge Chair (NO-CHAIR-LOBBY-NAVY) [ Fabric: Wool Navy ]".
  • For custom options, the option IDs and their values: {"options": {"3": "Fjordbygg AS", "4": "2", "6": ["5", "6"]}, "qty": 1}. A text option takes its text, a select option the ID of its value, a multiple-select option a list of value IDs.
mutation {
hidepriceRequestSubmit(
email: "ingrid.dahl@fjordbygg.example",
product_id: 2123,
product_options: "{\"super_attribute\":{\"183\":\"215\"},\"qty\":1}"
) {
request_id
product {
product_sku
attributes
option_array
}
}
}
{
"data": {
"hidepriceRequestSubmit": {
"request_id": 36,
"product": {
"product_sku": "NO-CHAIR-LOBBY-NAVY",
"attributes": "{\"183\":\"215\"}",
"option_array": "[{\"value\":\"Wool Navy\",\"label\":\"Fabric\"}]"
}
}
}
}

hidepriceRequestUpload​

Uploads one file and returns its hash as a string. Pass the hash in attachment of hidepriceRequestSubmit. The file is checked against Settings: File Attachments. A file not attached to a request within about an hour is removed.

Argument Type Description
filename String! File name with its extension, for example specs.pdf.
content String! The file as a data URI: data:<mime type>;base64,<base64 data>. Any other value is taken as plain content: it needs mimeType and is saved as the file's text.
mimeType String MIME type of the file. Taken from the data URI when you leave it out.
mutation {
hidepriceRequestUpload(
filename: "specs.pdf",
content: "data:application/pdf;base64,JVBERi0xLjQK...",
mimeType: "application/pdf"
)
}

Send the file as a data URI. A bare base64 string is saved as text, not decoded.

Data types​

HidePriceRequest: one request.

Field Type Description
request_id Int Internal ID.
increment_id String Request number shown in Price Requests and in the emails, for example "3000000038".
is_admin_notified, is_customer_notified Boolean Whether the email to your team and the confirmation to the customer have been sent.
start_message_id Int ID of the first message: the customer's message with its files.
store_id Int Store view the request was sent from.
customer_ip String IP address the request was sent from.
customer_email, customer_firstname, customer_lastname, customer_phone, message String What the customer entered, as typed and not HTML-encoded, for older requests too. Treat it as data and escape it before you show it in HTML.
custom_field_1, custom_field_2, custom_field_3 String Values of the custom fields.
is_replied, is_read Boolean Status flags shown in Price Requests.
created_at String When the request was created.
product HidePriceRequestedProduct The requested product.

HidePriceRequestedProduct: the requested product.

Field Type Description
product_id Int Product ID.
product_sku String Product SKU.
product_name String Product name.
attributes String JSON of the chosen configurable attribute and option IDs, for example {"183":"215"}. Empty for other products.
option_array String JSON list of the chosen options as value and label, configurable options included, for example [{"value":"Wool Navy","label":"Fabric"}]. "[]" without options.

HidePriceRequests: the answer of hidepriceRequests.

Field Type Description
items [HidePriceRequest!] The matching requests.
count Int! The number of requests in items.

Product prices​

Magento's own products query and the other catalog queries also respect HidePrice Pro. What they return for a hidden price is described in Price visibility in standard APIs.

Errors​

Errors come back in the standard GraphQL errors list.

Operation Message When
Any Module disabled. Enable Extension is No for the store of the call.
Any The current customer isn't authorized. No token, a customer token, or an integration call signed with OAuth 1.0a.
Any Composite reader could not read a token HTTP 401. An integration token sent as Bearer while Magento doesn't allow integration tokens as Bearer tokens.
Any The consumer isn't authorized to access resources. The admin role or the integration lacks MageMe_HidePricePro::manage_requests.
hidepriceRequest Request id must be greater than 0. request_id is below 1. A missing request_id is refused by GraphQL itself, because the argument is Int!.
hidepriceRequest Unable to find request item with ID "…" No request with that ID.
hidepriceRequests Incorrect filter format. filter isn't valid JSON.
hidepriceRequestSubmit Email field is required. / Invalid email. / Product is required. / Phone number is required. / "… is required." A required value is missing or invalid. The last message starts with the name of the custom field. Only the first error is returned. A missing email or product_id is refused by GraphQL itself (String!, Int!); "Email field is required." and "Product is required." come for an empty value.
hidepriceRequestSubmit Incorrect product options format. product_options isn't valid JSON.
hidepriceRequestSubmit Could not save request. The request could not be saved.
hidepriceRequestUpload Filename is required. / Content is required. / MimeType is required. An argument is missing; mimeType is needed when content isn't a data URI.
hidepriceRequestUpload Invalid URI data. The data URI can't be decoded.
hidepriceRequestUpload Could not upload file: … The file was refused. The message ends with the reason, for example "Could not upload file: Uploading of potentially dangerous files is not allowed." for an .exe file.

Examples​

A full run from another system:

  1. Upload the file with hidepriceRequestUpload and keep the hash it returns.
  2. Create the request with hidepriceRequestSubmit, passing the hash in attachment.
  3. Read unread requests with hidepriceRequests and the filter "{\"is_read\": \"0\"}".

Where to go next​

Last reviewed November 28, 2026