# subscriptionContractCreate - admin-graphql - MUTATION Version: 2024-10 ## Description Creates a Subscription Contract Draft. You can submit all the desired information for the draft using [Subscription Draft Input object](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/SubscriptionDraftInput). You can also update the draft using the [Subscription Contract Update](https://shopify.dev/docs/api/admin-graphql/latest/mutations/subscriptionContractUpdate) mutation. The draft is not saved until you call the [Subscription Draft Commit](https://shopify.dev/docs/api/admin-graphql/latest/mutations/subscriptionDraftCommit) mutation. ### Access Scopes `write_own_subscription_contracts` access scope. Also: The user must have manage_orders_information permission. ## Arguments * [input](/docs/api/admin-graphql/2024-10/input-objects/SubscriptionContractCreateInput): SubscriptionContractCreateInput! - The properties of the new Subscription Contract. ## Returns * [draft](/docs/api/admin-graphql/2024-10/objects/SubscriptionDraft): SubscriptionDraft The Subscription Contract object. * [userErrors](/docs/api/admin-graphql/2024-10/objects/SubscriptionDraftUserError): SubscriptionDraftUserError! The list of errors that occurred from executing the mutation. ## Examples ### Create a subscription contract with draft input Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation createSubscriptionContract($input: SubscriptionContractCreateInput!) { subscriptionContractCreate(input: $input) { draft { id } userErrors { field message } } }\",\n \"variables\": {\n \"input\": {\n \"customerId\": \"gid://shopify/Customer/544365967\",\n \"currencyCode\": \"USD\",\n \"nextBillingDate\": \"2024-10-11T21:11:01-04:00\",\n \"contract\": {\n \"status\": \"ACTIVE\",\n \"note\": \"Note of a thing.\",\n \"customAttributes\": [\n {\n \"key\": \"Test\",\n \"value\": \"Test value\"\n }\n ],\n \"paymentMethodId\": \"gid://shopify/CustomerPaymentMethod/b7cc6e3267aace169e516ed48be72dff\",\n \"billingPolicy\": {\n \"minCycles\": 3,\n \"maxCycles\": 12,\n \"intervalCount\": 1,\n \"interval\": \"MONTH\",\n \"anchors\": [\n {\n \"type\": \"MONTHDAY\",\n \"day\": 12\n }\n ]\n },\n \"deliveryPolicy\": {\n \"intervalCount\": 1,\n \"interval\": \"MONTH\",\n \"anchors\": [\n {\n \"type\": \"MONTHDAY\",\n \"day\": 13\n }\n ]\n },\n \"deliveryPrice\": 2.99,\n \"deliveryMethod\": {\n \"shipping\": {\n \"address\": {\n \"firstName\": \"Mont\",\n \"lastName\": \"Réal\",\n \"address1\": \"490 Rue De La Gauchetière O\",\n \"country\": \"Canada\",\n \"province\": \"Québec\",\n \"phone\": \"+16135551212\",\n \"zip\": \"H2Z 0B3\",\n \"city\": \"Montréal\"\n },\n \"shippingOption\": {\n \"title\": \"Subscription shipping\",\n \"presentmentTitle\": \"Translated shipping for subscription\",\n \"description\": \"5-7 Days\",\n \"code\": \"GROUND\",\n \"carrierServiceId\": null\n }\n }\n }\n }\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation createSubscriptionContract($input: SubscriptionContractCreateInput!) {\n subscriptionContractCreate(input: $input) {\n draft {\n id\n }\n userErrors {\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"input\": {\n \"customerId\": \"gid://shopify/Customer/544365967\",\n \"currencyCode\": \"USD\",\n \"nextBillingDate\": \"2024-10-11T21:11:01-04:00\",\n \"contract\": {\n \"status\": \"ACTIVE\",\n \"note\": \"Note of a thing.\",\n \"customAttributes\": [\n {\n \"key\": \"Test\",\n \"value\": \"Test value\"\n }\n ],\n \"paymentMethodId\": \"gid://shopify/CustomerPaymentMethod/b7cc6e3267aace169e516ed48be72dff\",\n \"billingPolicy\": {\n \"minCycles\": 3,\n \"maxCycles\": 12,\n \"intervalCount\": 1,\n \"interval\": \"MONTH\",\n \"anchors\": [\n {\n \"type\": \"MONTHDAY\",\n \"day\": 12\n }\n ]\n },\n \"deliveryPolicy\": {\n \"intervalCount\": 1,\n \"interval\": \"MONTH\",\n \"anchors\": [\n {\n \"type\": \"MONTHDAY\",\n \"day\": 13\n }\n ]\n },\n \"deliveryPrice\": 2.99,\n \"deliveryMethod\": {\n \"shipping\": {\n \"address\": {\n \"firstName\": \"Mont\",\n \"lastName\": \"Réal\",\n \"address1\": \"490 Rue De La Gauchetière O\",\n \"country\": \"Canada\",\n \"province\": \"Québec\",\n \"phone\": \"+16135551212\",\n \"zip\": \"H2Z 0B3\",\n \"city\": \"Montréal\"\n },\n \"shippingOption\": {\n \"title\": \"Subscription shipping\",\n \"presentmentTitle\": \"Translated shipping for subscription\",\n \"description\": \"5-7 Days\",\n \"code\": \"GROUND\",\n \"carrierServiceId\": null\n }\n }\n }\n }\n }\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation createSubscriptionContract($input: SubscriptionContractCreateInput!) {\n subscriptionContractCreate(input: $input) {\n draft {\n id\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"input\": {\n \"customerId\": \"gid://shopify/Customer/544365967\",\n \"currencyCode\": \"USD\",\n \"nextBillingDate\": \"2024-10-11T21:11:01-04:00\",\n \"contract\": {\n \"status\": \"ACTIVE\",\n \"note\": \"Note of a thing.\",\n \"customAttributes\": [{\"key\"=>\"Test\", \"value\"=>\"Test value\"}],\n \"paymentMethodId\": \"gid://shopify/CustomerPaymentMethod/b7cc6e3267aace169e516ed48be72dff\",\n \"billingPolicy\": {\n \"minCycles\": 3,\n \"maxCycles\": 12,\n \"intervalCount\": 1,\n \"interval\": \"MONTH\",\n \"anchors\": [{\"type\"=>\"MONTHDAY\", \"day\"=>12}]\n },\n \"deliveryPolicy\": {\n \"intervalCount\": 1,\n \"interval\": \"MONTH\",\n \"anchors\": [{\"type\"=>\"MONTHDAY\", \"day\"=>13}]\n },\n \"deliveryPrice\": 2.99,\n \"deliveryMethod\": {\n \"shipping\": {\n \"address\": {\n \"firstName\": \"Mont\",\n \"lastName\": \"Réal\",\n \"address1\": \"490 Rue De La Gauchetière O\",\n \"country\": \"Canada\",\n \"province\": \"Québec\",\n \"phone\": \"+16135551212\",\n \"zip\": \"H2Z 0B3\",\n \"city\": \"Montréal\"\n },\n \"shippingOption\": {\n \"title\": \"Subscription shipping\",\n \"presentmentTitle\": \"Translated shipping for subscription\",\n \"description\": \"5-7 Days\",\n \"code\": \"GROUND\",\n \"carrierServiceId\": null\n }\n }\n }\n }\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation createSubscriptionContract($input: SubscriptionContractCreateInput!) {\n subscriptionContractCreate(input: $input) {\n draft {\n id\n }\n userErrors {\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"input\": {\n \"customerId\": \"gid://shopify/Customer/544365967\",\n \"currencyCode\": \"USD\",\n \"nextBillingDate\": \"2024-10-11T21:11:01-04:00\",\n \"contract\": {\n \"status\": \"ACTIVE\",\n \"note\": \"Note of a thing.\",\n \"customAttributes\": [\n {\n \"key\": \"Test\",\n \"value\": \"Test value\"\n }\n ],\n \"paymentMethodId\": \"gid://shopify/CustomerPaymentMethod/b7cc6e3267aace169e516ed48be72dff\",\n \"billingPolicy\": {\n \"minCycles\": 3,\n \"maxCycles\": 12,\n \"intervalCount\": 1,\n \"interval\": \"MONTH\",\n \"anchors\": [\n {\n \"type\": \"MONTHDAY\",\n \"day\": 12\n }\n ]\n },\n \"deliveryPolicy\": {\n \"intervalCount\": 1,\n \"interval\": \"MONTH\",\n \"anchors\": [\n {\n \"type\": \"MONTHDAY\",\n \"day\": 13\n }\n ]\n },\n \"deliveryPrice\": 2.99,\n \"deliveryMethod\": {\n \"shipping\": {\n \"address\": {\n \"firstName\": \"Mont\",\n \"lastName\": \"Réal\",\n \"address1\": \"490 Rue De La Gauchetière O\",\n \"country\": \"Canada\",\n \"province\": \"Québec\",\n \"phone\": \"+16135551212\",\n \"zip\": \"H2Z 0B3\",\n \"city\": \"Montréal\"\n },\n \"shippingOption\": {\n \"title\": \"Subscription shipping\",\n \"presentmentTitle\": \"Translated shipping for subscription\",\n \"description\": \"5-7 Days\",\n \"code\": \"GROUND\",\n \"carrierServiceId\": null\n }\n }\n }\n }\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation createSubscriptionContract($input: SubscriptionContractCreateInput!) {\n subscriptionContractCreate(input: $input) {\n draft {\n id\n }\n userErrors {\n field\n message\n }\n }\n}" #### Graphql Input { "input": { "customerId": "gid://shopify/Customer/544365967", "currencyCode": "USD", "nextBillingDate": "2024-10-11T21:11:01-04:00", "contract": { "status": "ACTIVE", "note": "Note of a thing.", "customAttributes": [ { "key": "Test", "value": "Test value" } ], "paymentMethodId": "gid://shopify/CustomerPaymentMethod/b7cc6e3267aace169e516ed48be72dff", "billingPolicy": { "minCycles": 3, "maxCycles": 12, "intervalCount": 1, "interval": "MONTH", "anchors": [ { "type": "MONTHDAY", "day": 12 } ] }, "deliveryPolicy": { "intervalCount": 1, "interval": "MONTH", "anchors": [ { "type": "MONTHDAY", "day": 13 } ] }, "deliveryPrice": 2.99, "deliveryMethod": { "shipping": { "address": { "firstName": "Mont", "lastName": "Réal", "address1": "490 Rue De La Gauchetière O", "country": "Canada", "province": "Québec", "phone": "+16135551212", "zip": "H2Z 0B3", "city": "Montréal" }, "shippingOption": { "title": "Subscription shipping", "presentmentTitle": "Translated shipping for subscription", "description": "5-7 Days", "code": "GROUND", "carrierServiceId": null } } } } } } #### Graphql Response { "data": { "subscriptionContractCreate": { "draft": { "id": "gid://shopify/SubscriptionDraft/1055577422" }, "userErrors": [] } } }