> ## Documentation Index
> Fetch the complete documentation index at: https://developers.redo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# backInStockSubscriptionsImport

> Add shoppers to back-in-stock lists, as the back-in-stock CSV upload on the marketing analytics page does, such as subscribers moved from another tool. Each waits on one product variant and is notified by the store's back-in-stock flow when it restocks. Nothing is sent now and email consent doesn't change. Returns one result per input: OK with the new subscription; SKIPPED with ALREADY_SUBSCRIBED and the existing subscription when the email is already waiting on that product, so running an import again adds only what's new; SKIPPED with NOT_FOUND when the store has no such product; SKIPPED with UNSUPPORTED_PRODUCT_SOURCE for a product not from Shopify. A shopper already notified about that product is added again. Runs while the request waits, for 1 to 100 subscriptions. BAD_USER_INPUT for no inputs or too many, an invalid email, or an input naming neither or both of `productId` and `sourceId`; nothing is imported then. Needs the `campaigns_write` scope, as `productBackInStockNotify` does and as the app's upload needs Manage campaigns, though an import may also create customers.

**Required scopes:** [`campaigns_write`](https://developers.redo.com/docs/api-reference/v3/reference/scopes#scope-campaigns_write)

**Store must have one of:** `EMAIL_SMS`

## Arguments

**inputs** `[\[BackInStockSubscriptionCreateInput!\]!](/docs/api-reference/v3/reference/marketing/back-in-stock-subscription-create-input)` *required*

1 to 100 subscriptions. Each is checked before anything is written, and one that fails refuses the whole call, naming its index.

**fields**

**email** `String!` *required*

The email to notify, such as `shopper@example.com`.

**productId** `ID`

The product variant the shopper is waiting on.

**sourceId** `String`

The variant's Shopify id, as a GID such as `gid://shopify/ProductVariant/123` or the number alone.

**subscribedAt** `[DateTime](/docs/api-reference/v3/reference/common/date-time)`

When the shopper subscribed, to keep the date from another tool. Defaults to now.

## Returns

**backInStockSubscriptionsImport** `[BackInStockSubscriptionsImportResult!](/docs/api-reference/v3/reference/marketing/back-in-stock-subscriptions-import-result)` *required*

What an import did with each subscription. It runs while the request waits, so the result is final.

**fields**

**counts** `[BulkCounts!](/docs/api-reference/v3/reference/common/bulk-counts)` *required*

How many items ended each way.

**fields**

**failed** `Int!` *required*

The items that couldn't be changed.

**ok** `Int!` *required*

The items the action changed.

**skipped** `Int!` *required*

The items it didn't apply to.

**total** `Int!` *required*

The items given.

**results** `[\[BackInStockSubscriptionImportItem!\]!](/docs/api-reference/v3/reference/marketing/back-in-stock-subscription-import-item)` *required*

One per input, in the order of inputs; at most 100.

**fields**

**code** `String`

Why the item was skipped or failed: ALREADY\_SUBSCRIBED (SKIPPED), the email is already waiting on the product, and `subscription` names that subscription; NOT\_FOUND (SKIPPED), the store has no product with that `productId` or `sourceId`; UNSUPPORTED\_PRODUCT\_SOURCE (SKIPPED), the product isn't from Shopify. Null when it is OK.

**message** `String`

The same, in words. Null when it is OK.

**status** `[BulkItemStatus!](/docs/api-reference/v3/reference/common/bulk-item-status)` *required*

What the action did with the item.

**subscription** `[BackInStockSubscription](/docs/api-reference/v3/reference/marketing/back-in-stock-subscription)`

The subscription the import created, or for ALREADY\_SUBSCRIBED the one already waiting. Null otherwise.

**fields**

**email** `String`

The email to notify. At least one of email and phone is set.

**id** `ID!` *required*

The id of this subscription.

**notifiedAt** `[DateTime](/docs/api-reference/v3/reference/common/date-time)`

When a send took this subscription. Null while waiting.

**phone** `String`

The phone number to notify. At least one of email and phone is set.

**product** `[Product](/docs/api-reference/v3/reference/catalog/product)`

The product the shopper is waiting on. Null when that variant is no longer in the catalog.

**Requires:** [`products_read`](https://developers.redo.com/docs/api-reference/v3/reference/scopes#scope-products_read)

**status** `[BackInStockSubscriptionStatus!](/docs/api-reference/v3/reference/marketing/back-in-stock-subscription-status)` *required*

Whether this subscriber is still waiting.

**subscribedAt** `[DateTime!](/docs/api-reference/v3/reference/common/date-time)` *required*

When the shopper subscribed.

## Errors

Besides the [errors any request can return](https://developers.redo.com/docs/api-reference/v3/errors.md), this operation fails with these codes in `extensions.code`.

| Code | HTTP status | Meaning | Retry |
| - | - | - | - |
| `BAD_USER_INPUT` | `400` | An argument is invalid, or names something the store doesn't have. The message says which. Nothing was written. | Fix the input the message names, then send it again. |
| `INTERNAL_SERVER_ERROR` | `500` | Something failed on Redo's side. The change may or may not have been made. | Read the record to see whether the change was made before sending it again. A send with an idempotencyKey is safe to retry with the same key. |

## Example

```graphql theme={null}
mutation {
  backInStockSubscriptionsImport(inputs: { ... })
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.