How to generate bulk discount codes without errors?

Topic summary

Issue: A user cannot create bulk discount codes via Shopify Admin API. Their POST to /admin/api/2023-10/price_rules/PriceRuleID/batch.json returns an error: “discount_codes: Required parameter missing or invalid.” PriceRuleID refers to the target price rule.

Clarifications requested: They ask what parameter(s) are missing beyond the PriceRuleID, noting the documentation doesn’t list additional required parameters for this endpoint. They also ask how to specify the number of codes to generate (e.g., 50) when calling this endpoint.

Status: No solution or guidance provided yet; the thread remains unresolved with open questions on required request payload fields and how to define the quantity of discount codes.

Summarized with AI on January 10. AI used: gpt-5.

I am getting below error when I send the POST request to this end point -

/admin/api/2023-10/price_rules/PriceRuleID/batch.json

What is it that I am missing? API documentation does not list any need of additional parameter besides Price rule id.

Also how do I enter no. of discount codes i need? For ex. if i need 50 codes, how should I add to this end point?

{

Errors: {

discount_codes: Required parameter missing or invalid

}

}