> For the complete documentation index, see [llms.txt](https://docs.tnid.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tnid.com/company/b2c-features/upsert-b2c-subscription.md).

# Upsert B2C Subscription

```
mutation (
    $companyId: ID!
    $type: B2cSubscriptionType!
    $emailId: ID
    $telephoneNumberId: ID
    $subscriptionTopicIds: [ID!]!
    $expirationDate: Date
    $notificationStartTime: Time
    $notificationEndTime: Time
  ) {
    upsertB2cSubscription (
      companyId: $companyId
      type: $type
      emailId: $emailId
      telephoneNumberId: $telephoneNumberId
      subscriptionTopicIds: $subscriptionTopicIds
      expirationDate: $expirationDate
      notificationStartTime: $notificationStartTime
      notificationEndTime: $notificationEndTime
      ) {
        ... on B2cEmailSubscription {
          id
          insertedAt
          updatedAt
          type
          subscriptionTopics
          expirationDate
          notificationStartTime
          notificationEndTime
          email
          company {
            id
          }
          user {
            id
          }
        }
        ... on B2cSmsSubscription {
          id
          insertedAt
          updatedAt
          type
          subscriptionTopics
          expirationDate
          notificationStartTime
          notificationEndTime
          telephoneNumber
          company {
            id
          }
          user {
            id
          }
        }
        ... on B2cVoiceSubscription {
          id
          insertedAt
          updatedAt
          type
          subscriptionTopics
          expirationDate
          notificationStartTime
          notificationEndTime
          telephoneNumber
          company {
            id
          }
          user {
            id
          }
        }

```
