# subscriptionBillingCycleBulkSearch - admin-graphql - MUTATION Version: 2024-10 ## Description 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. ### Access Scopes `write_own_subscription_contracts` access scope. Also: The user must have manage_orders_information permission. ## Arguments * [billingAttemptExpectedDateRange](/docs/api/admin-graphql/2024-10/input-objects/SubscriptionBillingCyclesDateRangeSelector): SubscriptionBillingCyclesDateRangeSelector! - Specifies the date range within which the `billingAttemptExpectedDate` values of the billing cycles should fall. * [filters](/docs/api/admin-graphql/2024-10/input-objects/SubscriptionBillingCycleBulkFilters): SubscriptionBillingCycleBulkFilters - Criteria to filter the billing cycles on which the action is executed. ## Returns * [job](/docs/api/admin-graphql/2024-10/objects/Job): Job The asynchronous job that performs the action on the targeted billing cycles. * [userErrors](/docs/api/admin-graphql/2024-10/objects/SubscriptionBillingCycleBulkUserError): SubscriptionBillingCycleBulkUserError! The list of errors that occurred from executing the mutation. ## Examples ### Create a job to search for all subscription billing cycles in time range 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($startDate: DateTime!, $endDate: DateTime!) { subscriptionBillingCycleBulkSearch(billingAttemptExpectedDateRange: {startDate: $startDate, endDate: $endDate}) { job { id } } }\",\n \"variables\": {\n \"startDate\": \"2023-02-01T00:00:00-05:00\",\n \"endDate\": \"2023-02-02T23:59:59-05:00\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation($startDate: DateTime!, $endDate: DateTime!) {\n subscriptionBillingCycleBulkSearch(billingAttemptExpectedDateRange: {startDate: $startDate, endDate: $endDate}) {\n job {\n id\n }\n }\n }`,\n \"variables\": {\n \"startDate\": \"2023-02-01T00:00:00-05:00\",\n \"endDate\": \"2023-02-02T23:59:59-05:00\"\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($startDate: DateTime!, $endDate: DateTime!) {\n subscriptionBillingCycleBulkSearch(billingAttemptExpectedDateRange: {startDate: $startDate, endDate: $endDate}) {\n job {\n id\n }\n }\n }\nQUERY\n\nvariables = {\n \"startDate\": \"2023-02-01T00:00:00-05:00\",\n \"endDate\": \"2023-02-02T23:59:59-05:00\"\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($startDate: DateTime!, $endDate: DateTime!) {\n subscriptionBillingCycleBulkSearch(billingAttemptExpectedDateRange: {startDate: $startDate, endDate: $endDate}) {\n job {\n id\n }\n }\n }`,\n {\n variables: {\n \"startDate\": \"2023-02-01T00:00:00-05:00\",\n \"endDate\": \"2023-02-02T23:59:59-05:00\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation($startDate: DateTime!, $endDate: DateTime!) {\n subscriptionBillingCycleBulkSearch(billingAttemptExpectedDateRange: {startDate: $startDate, endDate: $endDate}) {\n job {\n id\n }\n }\n}" #### Graphql Input { "startDate": "2023-02-01T00:00:00-05:00", "endDate": "2023-02-02T23:59:59-05:00" } #### Graphql Response { "data": { "subscriptionBillingCycleBulkSearch": { "job": { "id": "gid://shopify/Job/ea4e2f15-8508-4930-8de5-0e31c8b7014e" } } } }