Version: 2024-10
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 createDeliveryProfile($profile: DeliveryProfileInput!) { deliveryProfileCreate(profile: $profile) { profile { id name profileLocationGroups { locationGroup { id locations(first: 5) { nodes { name address { country } } } } locationGroupZones(first: 2) { edges { node { zone { id name countries { code { countryCode } provinces { code } } } } } } } } userErrors { field message } } }\",\n \"variables\": {\n \"profile\": {\n \"name\": \"Sample Delivery Profile\",\n \"locationGroupsToCreate\": [\n {\n \"locationsToAdd\": [\n \"gid://shopify/Location/750123840\",\n \"gid://shopify/Location/884687543\"\n ],\n \"zonesToCreate\": [\n {\n \"name\": \"Canada Zone\",\n \"countries\": [\n {\n \"code\": \"CA\",\n \"provinces\": [\n {\n \"code\": \"ON\"\n }\n ]\n }\n ],\n \"methodDefinitionsToCreate\": [\n {\n \"name\": \"Standard\",\n \"rateDefinition\": {\n \"price\": {\n \"amount\": 1.0,\n \"currencyCode\": \"USD\"\n }\n },\n \"weightConditionsToCreate\": [\n {\n \"operator\": \"GREATER_THAN_OR_EQUAL_TO\",\n \"criteria\": {\n \"value\": 0,\n \"unit\": \"KILOGRAMS\"\n }\n },\n {\n \"operator\": \"LESS_THAN_OR_EQUAL_TO\",\n \"criteria\": {\n \"value\": 15.0,\n \"unit\": \"KILOGRAMS\"\n }\n }\n ]\n }\n ]\n }\n ]\n },\n {\n \"locationsToAdd\": [\n \"gid://shopify/Location/415211365\"\n ],\n \"zonesToCreate\": [\n {\n \"name\": \"USA Zone\",\n \"countries\": {\n \"code\": \"US\",\n \"provinces\": [\n {\n \"code\": \"CO\"\n }\n ]\n },\n \"methodDefinitionsToCreate\": [\n {\n \"name\": \"Standard\",\n \"rateDefinition\": {\n \"price\": {\n \"amount\": 1.0,\n \"currencyCode\": \"USD\"\n }\n }\n }\n ]\n },\n {\n \"name\": \"Mexico Zone\",\n \"countries\": {\n \"code\": \"MX\",\n \"provinces\": [\n {\n \"code\": \"MOR\"\n }\n ]\n },\n \"methodDefinitionsToCreate\": [\n {\n \"name\": \"Standard\",\n \"rateDefinition\": {\n \"price\": {\n \"amount\": 1.0,\n \"currencyCode\": \"USD\"\n }\n }\n }\n ]\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 createDeliveryProfile($profile: DeliveryProfileInput!) {\n deliveryProfileCreate(profile: $profile) {\n profile {\n id\n name\n profileLocationGroups {\n locationGroup {\n id\n locations(first: 5) {\n nodes {\n name\n address {\n country\n }\n }\n }\n }\n locationGroupZones(first: 2) {\n edges {\n node {\n zone {\n id\n name\n countries {\n code {\n countryCode\n }\n provinces {\n code\n }\n }\n }\n }\n }\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"profile\": {\n \"name\": \"Sample Delivery Profile\",\n \"locationGroupsToCreate\": [\n {\n \"locationsToAdd\": [\n \"gid://shopify/Location/750123840\",\n \"gid://shopify/Location/884687543\"\n ],\n \"zonesToCreate\": [\n {\n \"name\": \"Canada Zone\",\n \"countries\": [\n {\n \"code\": \"CA\",\n \"provinces\": [\n {\n \"code\": \"ON\"\n }\n ]\n }\n ],\n \"methodDefinitionsToCreate\": [\n {\n \"name\": \"Standard\",\n \"rateDefinition\": {\n \"price\": {\n \"amount\": 1.0,\n \"currencyCode\": \"USD\"\n }\n },\n \"weightConditionsToCreate\": [\n {\n \"operator\": \"GREATER_THAN_OR_EQUAL_TO\",\n \"criteria\": {\n \"value\": 0,\n \"unit\": \"KILOGRAMS\"\n }\n },\n {\n \"operator\": \"LESS_THAN_OR_EQUAL_TO\",\n \"criteria\": {\n \"value\": 15.0,\n \"unit\": \"KILOGRAMS\"\n }\n }\n ]\n }\n ]\n }\n ]\n },\n {\n \"locationsToAdd\": [\n \"gid://shopify/Location/415211365\"\n ],\n \"zonesToCreate\": [\n {\n \"name\": \"USA Zone\",\n \"countries\": {\n \"code\": \"US\",\n \"provinces\": [\n {\n \"code\": \"CO\"\n }\n ]\n },\n \"methodDefinitionsToCreate\": [\n {\n \"name\": \"Standard\",\n \"rateDefinition\": {\n \"price\": {\n \"amount\": 1.0,\n \"currencyCode\": \"USD\"\n }\n }\n }\n ]\n },\n {\n \"name\": \"Mexico Zone\",\n \"countries\": {\n \"code\": \"MX\",\n \"provinces\": [\n {\n \"code\": \"MOR\"\n }\n ]\n },\n \"methodDefinitionsToCreate\": [\n {\n \"name\": \"Standard\",\n \"rateDefinition\": {\n \"price\": {\n \"amount\": 1.0,\n \"currencyCode\": \"USD\"\n }\n }\n }\n ]\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 createDeliveryProfile($profile: DeliveryProfileInput!) {\n deliveryProfileCreate(profile: $profile) {\n profile {\n id\n name\n profileLocationGroups {\n locationGroup {\n id\n locations(first: 5) {\n nodes {\n name\n address {\n country\n }\n }\n }\n }\n locationGroupZones(first: 2) {\n edges {\n node {\n zone {\n id\n name\n countries {\n code {\n countryCode\n }\n provinces {\n code\n }\n }\n }\n }\n }\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"profile\": {\n \"name\": \"Sample Delivery Profile\",\n \"locationGroupsToCreate\": [{\"locationsToAdd\"=>[\"gid://shopify/Location/750123840\", \"gid://shopify/Location/884687543\"], \"zonesToCreate\"=>[{\"name\"=>\"Canada Zone\", \"countries\"=>[{\"code\"=>\"CA\", \"provinces\"=>[{\"code\"=>\"ON\"}]}], \"methodDefinitionsToCreate\"=>[{\"name\"=>\"Standard\", \"rateDefinition\"=>{\"price\"=>{\"amount\"=>1.0, \"currencyCode\"=>\"USD\"}}, \"weightConditionsToCreate\"=>[{\"operator\"=>\"GREATER_THAN_OR_EQUAL_TO\", \"criteria\"=>{\"value\"=>0, \"unit\"=>\"KILOGRAMS\"}}, {\"operator\"=>\"LESS_THAN_OR_EQUAL_TO\", \"criteria\"=>{\"value\"=>15.0, \"unit\"=>\"KILOGRAMS\"}}]}]}]}, {\"locationsToAdd\"=>[\"gid://shopify/Location/415211365\"], \"zonesToCreate\"=>[{\"name\"=>\"USA Zone\", \"countries\"=>{\"code\"=>\"US\", \"provinces\"=>[{\"code\"=>\"CO\"}]}, \"methodDefinitionsToCreate\"=>[{\"name\"=>\"Standard\", \"rateDefinition\"=>{\"price\"=>{\"amount\"=>1.0, \"currencyCode\"=>\"USD\"}}}]}, {\"name\"=>\"Mexico Zone\", \"countries\"=>{\"code\"=>\"MX\", \"provinces\"=>[{\"code\"=>\"MOR\"}]}, \"methodDefinitionsToCreate\"=>[{\"name\"=>\"Standard\", \"rateDefinition\"=>{\"price\"=>{\"amount\"=>1.0, \"currencyCode\"=>\"USD\"}}}]}]}]\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<[\n \"name\" => \"Sample Delivery Profile\",\n \"locationGroupsToCreate\" => [{\"locationsToAdd\"=>[\"gid://shopify/Location/750123840\", \"gid://shopify/Location/884687543\"], \"zonesToCreate\"=>[{\"name\"=>\"Canada Zone\", \"countries\"=>[{\"code\"=>\"CA\", \"provinces\"=>[{\"code\"=>\"ON\"}]}], \"methodDefinitionsToCreate\"=>[{\"name\"=>\"Standard\", \"rateDefinition\"=>{\"price\"=>{\"amount\"=>1.0, \"currencyCode\"=>\"USD\"}}, \"weightConditionsToCreate\"=>[{\"operator\"=>\"GREATER_THAN_OR_EQUAL_TO\", \"criteria\"=>{\"value\"=>0, \"unit\"=>\"KILOGRAMS\"}}, {\"operator\"=>\"LESS_THAN_OR_EQUAL_TO\", \"criteria\"=>{\"value\"=>15.0, \"unit\"=>\"KILOGRAMS\"}}]}]}]}, {\"locationsToAdd\"=>[\"gid://shopify/Location/415211365\"], \"zonesToCreate\"=>[{\"name\"=>\"USA Zone\", \"countries\"=>{\"code\"=>\"US\", \"provinces\"=>[{\"code\"=>\"CO\"}]}, \"methodDefinitionsToCreate\"=>[{\"name\"=>\"Standard\", \"rateDefinition\"=>{\"price\"=>{\"amount\"=>1.0, \"currencyCode\"=>\"USD\"}}}]}, {\"name\"=>\"Mexico Zone\", \"countries\"=>{\"code\"=>\"MX\", \"provinces\"=>[{\"code\"=>\"MOR\"}]}, \"methodDefinitionsToCreate\"=>[{\"name\"=>\"Standard\", \"rateDefinition\"=>{\"price\"=>{\"amount\"=>1.0, \"currencyCode\"=>\"USD\"}}}]}]}],\n ],\n];\n\n$response = $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 createDeliveryProfile($profile: DeliveryProfileInput!) {\n deliveryProfileCreate(profile: $profile) {\n profile {\n id\n name\n profileLocationGroups {\n locationGroup {\n id\n locations(first: 5) {\n nodes {\n name\n address {\n country\n }\n }\n }\n }\n locationGroupZones(first: 2) {\n edges {\n node {\n zone {\n id\n name\n countries {\n code {\n countryCode\n }\n provinces {\n code\n }\n }\n }\n }\n }\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"profile\": {\n \"name\": \"Sample Delivery Profile\",\n \"locationGroupsToCreate\": [\n {\n \"locationsToAdd\": [\n \"gid://shopify/Location/750123840\",\n \"gid://shopify/Location/884687543\"\n ],\n \"zonesToCreate\": [\n {\n \"name\": \"Canada Zone\",\n \"countries\": [\n {\n \"code\": \"CA\",\n \"provinces\": [\n {\n \"code\": \"ON\"\n }\n ]\n }\n ],\n \"methodDefinitionsToCreate\": [\n {\n \"name\": \"Standard\",\n \"rateDefinition\": {\n \"price\": {\n \"amount\": 1.0,\n \"currencyCode\": \"USD\"\n }\n },\n \"weightConditionsToCreate\": [\n {\n \"operator\": \"GREATER_THAN_OR_EQUAL_TO\",\n \"criteria\": {\n \"value\": 0,\n \"unit\": \"KILOGRAMS\"\n }\n },\n {\n \"operator\": \"LESS_THAN_OR_EQUAL_TO\",\n \"criteria\": {\n \"value\": 15.0,\n \"unit\": \"KILOGRAMS\"\n }\n }\n ]\n }\n ]\n }\n ]\n },\n {\n \"locationsToAdd\": [\n \"gid://shopify/Location/415211365\"\n ],\n \"zonesToCreate\": [\n {\n \"name\": \"USA Zone\",\n \"countries\": {\n \"code\": \"US\",\n \"provinces\": [\n {\n \"code\": \"CO\"\n }\n ]\n },\n \"methodDefinitionsToCreate\": [\n {\n \"name\": \"Standard\",\n \"rateDefinition\": {\n \"price\": {\n \"amount\": 1.0,\n \"currencyCode\": \"USD\"\n }\n }\n }\n ]\n },\n {\n \"name\": \"Mexico Zone\",\n \"countries\": {\n \"code\": \"MX\",\n \"provinces\": [\n {\n \"code\": \"MOR\"\n }\n ]\n },\n \"methodDefinitionsToCreate\": [\n {\n \"name\": \"Standard\",\n \"rateDefinition\": {\n \"price\": {\n \"amount\": 1.0,\n \"currencyCode\": \"USD\"\n }\n }\n }\n ]\n }\n ]\n }\n ]\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation createDeliveryProfile($profile: DeliveryProfileInput!) {\n deliveryProfileCreate(profile: $profile) {\n profile {\n id\n name\n profileLocationGroups {\n locationGroup {\n id\n locations(first: 5) {\n nodes {\n name\n address {\n country\n }\n }\n }\n }\n locationGroupZones(first: 2) {\n edges {\n node {\n zone {\n id\n name\n countries {\n code {\n countryCode\n }\n provinces {\n code\n }\n }\n }\n }\n }\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n}"
input: { "profile": { "name": "Sample Delivery Profile", "locationGroupsToCreate": [ { "locationsToAdd": [ "gid://shopify/Location/750123840", "gid://shopify/Location/884687543" ], "zonesToCreate": [ { "name": "Canada Zone", "countries": [ { "code": "CA", "provinces": [ { "code": "ON" } ] } ], "methodDefinitionsToCreate": [ { "name": "Standard", "rateDefinition": { "price": { "amount": 1.0, "currencyCode": "USD" } }, "weightConditionsToCreate": [ { "operator": "GREATER_THAN_OR_EQUAL_TO", "criteria": { "value": 0, "unit": "KILOGRAMS" } }, { "operator": "LESS_THAN_OR_EQUAL_TO", "criteria": { "value": 15.0, "unit": "KILOGRAMS" } } ] } ] } ] }, { "locationsToAdd": [ "gid://shopify/Location/415211365" ], "zonesToCreate": [ { "name": "USA Zone", "countries": { "code": "US", "provinces": [ { "code": "CO" } ] }, "methodDefinitionsToCreate": [ { "name": "Standard", "rateDefinition": { "price": { "amount": 1.0, "currencyCode": "USD" } } } ] }, { "name": "Mexico Zone", "countries": { "code": "MX", "provinces": [ { "code": "MOR" } ] }, "methodDefinitionsToCreate": [ { "name": "Standard", "rateDefinition": { "price": { "amount": 1.0, "currencyCode": "USD" } } } ] } ] } ] } }
response: { "data": { "deliveryProfileCreate": { "profile": { "id": "gid://shopify/DeliveryProfile/933922679", "name": "Sample Delivery Profile", "profileLocationGroups": [ { "locationGroup": { "id": "gid://shopify/DeliveryLocationGroup/982182448", "locations": { "nodes": [ { "name": "Ottawa Warehouse", "address": { "country": "Canada" } }, { "name": "Toronto Store", "address": { "country": "Canada" } } ] } }, "locationGroupZones": { "edges": [ { "node": { "zone": { "id": "gid://shopify/DeliveryZone/1066475772", "name": "Canada Zone", "countries": [ { "code": { "countryCode": "CA" }, "provinces": [ { "code": "ON" } ] } ] } } } ] } }, { "locationGroup": { "id": "gid://shopify/DeliveryLocationGroup/982182449", "locations": { "nodes": [ { "name": "US Store", "address": { "country": "United States" } } ] } }, "locationGroupZones": { "edges": [ { "node": { "zone": { "id": "gid://shopify/DeliveryZone/1066475774", "name": "Mexico Zone", "countries": [ { "code": { "countryCode": "MX" }, "provinces": [ { "code": "MOR" } ] } ] } } }, { "node": { "zone": { "id": "gid://shopify/DeliveryZone/1066475773", "name": "USA Zone", "countries": [ { "code": { "countryCode": "US" }, "provinces": [ { "code": "CO" } ] } ] } } } ] } } ] }, "userErrors": [] } } }