# Job - admin-graphql - OBJECT Version: 2024-10 ## Description A job corresponds to some long running task that the client should poll for status. ### Access Scopes ## Fields * [done](/docs/api/admin-graphql/2024-10/scalars/Boolean): Boolean! - This indicates if the job is still queued or has been run. * [id](/docs/api/admin-graphql/2024-10/scalars/ID): ID! - A globally-unique ID that's returned when running an asynchronous mutation. * [query](/docs/api/admin-graphql/2024-10/objects/QueryRoot): QueryRoot - This field will only resolve once the job is done. Can be used to ask for object(s) that have been changed by the job. ## Connections ## Related queries * [job](/docs/api/admin-graphql/2024-10/queries/job) Returns a Job resource by ID. Used to check the status of internal jobs and any applicable changes. ## Related mutations * [collectionAddProductsV2](/docs/api/admin-graphql/2024-10/mutations/collectionAddProductsV2) Asynchronously adds a set of products to a given collection. It can take a long time to run. Instead of returning a collection, it returns a job which should be polled. * [collectionRemoveProducts](/docs/api/admin-graphql/2024-10/mutations/collectionRemoveProducts) Removes a set of products from a given collection. The mutation can take a long time to run. Instead of returning an updated collection the mutation returns a job, which should be [polled](https://shopify.dev/api/admin-graphql/latest/queries/job). For use with manual collections only. * [collectionReorderProducts](/docs/api/admin-graphql/2024-10/mutations/collectionReorderProducts) Asynchronously reorders a set of products within a specified collection. Instead of returning an updated collection, this mutation returns a job, which should be [polled](https://shopify.dev/api/admin-graphql/latest/queries/job). The [`Collection.sortOrder`](https://shopify.dev/api/admin-graphql/latest/objects/Collection#field-collection-sortorder) must be `MANUAL`. Displaced products will have their position altered in a consistent manner, with no gaps. * [collectionUpdate](/docs/api/admin-graphql/2024-10/mutations/collectionUpdate) Updates a collection. * [customerMerge](/docs/api/admin-graphql/2024-10/mutations/customerMerge) Merges two customers. * [deliveryProfileRemove](/docs/api/admin-graphql/2024-10/mutations/deliveryProfileRemove) Enqueue the removal of a delivery profile. * [discountAutomaticBulkDelete](/docs/api/admin-graphql/2024-10/mutations/discountAutomaticBulkDelete) Asynchronously delete automatic discounts in bulk if a `search` or `saved_search_id` argument is provided or if a maximum discount threshold is reached (1,000). Otherwise, deletions will occur inline. **Warning:** All automatic discounts will be deleted if a blank `search` argument is provided. * [discountCodeBulkActivate](/docs/api/admin-graphql/2024-10/mutations/discountCodeBulkActivate) Activates multiple [code discounts](https://help.shopify.com/manual/discounts/discount-types#discount-codes) asynchronously using one of the following: - A search query - A saved search ID - A list of discount code IDs For example, you can activate discounts for all codes that match a search criteria, or activate a predefined set of discount codes. * [discountCodeBulkDeactivate](/docs/api/admin-graphql/2024-10/mutations/discountCodeBulkDeactivate) Deactivates multiple [code-based discounts](https://help.shopify.com/manual/discounts/discount-types#discount-codes) asynchronously using one of the following: - A search query - A saved search ID - A list of discount code IDs For example, you can deactivate discounts for all codes that match a search criteria, or deactivate a predefined set of discount codes. * [discountCodeBulkDelete](/docs/api/admin-graphql/2024-10/mutations/discountCodeBulkDelete) Deletes multiple [code-based discounts](https://help.shopify.com/manual/discounts/discount-types#discount-codes) asynchronously using one of the following: - A search query - A saved search ID - A list of discount code IDs For example, you can delete discounts for all codes that match a search criteria, or delete a predefined set of discount codes. * [discountCodeRedeemCodeBulkDelete](/docs/api/admin-graphql/2024-10/mutations/discountCodeRedeemCodeBulkDelete) Asynchronously delete discount redeem codes in bulk. Specify the redeem codes to delete by providing a search query, a saved search ID, or a list of redeem code IDs. * [draftOrderBulkAddTags](/docs/api/admin-graphql/2024-10/mutations/draftOrderBulkAddTags) Adds tags to multiple draft orders. * [draftOrderBulkDelete](/docs/api/admin-graphql/2024-10/mutations/draftOrderBulkDelete) Deletes multiple draft orders. * [draftOrderBulkRemoveTags](/docs/api/admin-graphql/2024-10/mutations/draftOrderBulkRemoveTags) Removes tags from multiple draft orders. * [marketingActivitiesDeleteAllExternal](/docs/api/admin-graphql/2024-10/mutations/marketingActivitiesDeleteAllExternal) Deletes all external marketing activities. Deletion is performed by a background job, as it may take a bit of time to complete if a large number of activities are to be deleted. Attempting to create or modify external activities before the job has completed will result in the create/update/upsert mutation returning an error. * [metafieldDefinitionUpdate](/docs/api/admin-graphql/2024-10/mutations/metafieldDefinitionUpdate) Updates a metafield definition. * [metaobjectBulkDelete](/docs/api/admin-graphql/2024-10/mutations/metaobjectBulkDelete) Asynchronously delete metaobjects and their associated metafields in bulk. * [orderCancel](/docs/api/admin-graphql/2024-10/mutations/orderCancel) Cancels an order. * [orderCreateMandatePayment](/docs/api/admin-graphql/2024-10/mutations/orderCreateMandatePayment) Creates a payment for an order by mandate. * [productDuplicate](/docs/api/admin-graphql/2024-10/mutations/productDuplicate) Duplicates a product. If you need to duplicate a large product, such as one that has many [variants](https://shopify.dev/api/admin-graphql/latest/input-objects/ProductVariantInput) that are active at several [locations](https://shopify.dev/api/admin-graphql/latest/input-objects/InventoryLevelInput), you might encounter timeout errors. To avoid these timeout errors, you can instead duplicate the product asynchronously. In API version 2024-10 and higher, include `synchronous: false` argument in this mutation to perform the duplication asynchronously. In API version 2024-07 and lower, use the asynchronous [`ProductDuplicateAsyncV2`](https://shopify.dev/api/admin-graphql/2024-07/mutations/productDuplicateAsyncV2). * [productReorderMedia](/docs/api/admin-graphql/2024-10/mutations/productReorderMedia) Asynchronously reorders the media attached to a product. * [subscriptionBillingCycleBulkCharge](/docs/api/admin-graphql/2024-10/mutations/subscriptionBillingCycleBulkCharge) Asynchronously queries and charges all subscription billing cycles whose [billingAttemptExpectedDate](https://shopify.dev/api/admin-graphql/latest/objects/SubscriptionBillingCycle#field-billingattemptexpecteddate) values fall within a specified date range and meet additional filtering criteria. The results of this action can be retrieved using the [subscriptionBillingCycleBulkResults](https://shopify.dev/api/admin-graphql/latest/queries/subscriptionBillingCycleBulkResults) query. * [subscriptionBillingCycleBulkSearch](/docs/api/admin-graphql/2024-10/mutations/subscriptionBillingCycleBulkSearch) Asynchronously queries all subscription billing cycles whose [billingAttemptExpectedDate](https://shopify.dev/api/admin-graphql/latest/objects/SubscriptionBillingCycle#field-billingattemptexpecteddate) values fall within a specified date range and meet additional filtering criteria. The results of this action can be retrieved using the [subscriptionBillingCycleBulkResults](https://shopify.dev/api/admin-graphql/latest/queries/subscriptionBillingCycleBulkResults) query. * [themeFilesUpsert](/docs/api/admin-graphql/2024-10/mutations/themeFilesUpsert) Create or update theme files. * [urlRedirectBulkDeleteAll](/docs/api/admin-graphql/2024-10/mutations/urlRedirectBulkDeleteAll) Asynchronously delete [URL redirects](https://shopify.dev/api/admin-graphql/latest/objects/UrlRedirect) in bulk. * [urlRedirectBulkDeleteByIds](/docs/api/admin-graphql/2024-10/mutations/urlRedirectBulkDeleteByIds) Asynchronously delete [URLRedirect](https://shopify.dev/api/admin-graphql/latest/objects/UrlRedirect) objects in bulk by IDs. Learn more about [URLRedirect](https://help.shopify.com/en/manual/online-store/menus-and-links/url-redirect) objects. * [urlRedirectBulkDeleteBySavedSearch](/docs/api/admin-graphql/2024-10/mutations/urlRedirectBulkDeleteBySavedSearch) Asynchronously delete redirects in bulk. * [urlRedirectBulkDeleteBySearch](/docs/api/admin-graphql/2024-10/mutations/urlRedirectBulkDeleteBySearch) Asynchronously delete redirects in bulk. * [urlRedirectImportSubmit](/docs/api/admin-graphql/2024-10/mutations/urlRedirectImportSubmit) Submits a `UrlRedirectImport` request to be processed. The `UrlRedirectImport` request is first created with the [`urlRedirectImportCreate`](https://shopify.dev/api/admin-graphql/latest/mutations/urlRedirectImportCreate) mutation. ## Related Unions ## Examples ### Get the status of a queued collectionUpdate job 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\": \"query { job(id: \\\"gid://shopify/Job/dc9b2604-c73b-45c6-8942-e235bac987e8\\\") { id done } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n job(id: \"gid://shopify/Job/dc9b2604-c73b-45c6-8942-e235bac987e8\") {\n id\n done\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 query {\n job(id: \"gid://shopify/Job/dc9b2604-c73b-45c6-8942-e235bac987e8\") {\n id\n done\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n job(id: \"gid://shopify/Job/dc9b2604-c73b-45c6-8942-e235bac987e8\") {\n id\n done\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n job(id: \"gid://shopify/Job/dc9b2604-c73b-45c6-8942-e235bac987e8\") {\n id\n done\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "job": { "id": "gid://shopify/Job/dc9b2604-c73b-45c6-8942-e235bac987e8", "done": false } } }