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

# Delete user subscription topic

> Removes a user's override for one subscription topic, resetting it to the effective default from the tenant or workspace.



## OpenAPI

````yaml /openapi-specs/openapi.documented.yml delete /users/{user_id}/preferences/{topic_id}
openapi: 3.0.1
info:
  title: Courier
  description: The Courier REST API for sending and managing notifications across channels.
  version: 0.0.1
servers:
  - url: https://api.courier.com
    description: Production
security: []
paths:
  /users/{user_id}/preferences/{topic_id}:
    delete:
      tags:
        - User Preferences
      summary: Delete user subscription topic
      description: >-
        Removes a user's override for one subscription topic, resetting it to
        the effective default from the tenant or workspace.
      operationId: users_preferences_delete
      parameters:
        - name: user_id
          in: path
          description: >-
            A unique identifier associated with the user whose preferences you
            wish to delete.
          required: true
          schema:
            type: string
          examples:
            Example1:
              value: abc-123
        - name: topic_id
          in: path
          description: A unique identifier associated with a subscription topic.
          required: true
          schema:
            type: string
          examples:
            Example1:
              value: pt_01kx4h2jdafq8bk996nn92357r
        - name: tenant_id
          in: query
          description: Delete the preferences of a user for this specific tenant context.
          required: false
          schema:
            type: string
            nullable: true
      responses:
        '204':
          description: The user's topic preference was deleted, or did not exist.
      security:
        - BearerAuth: []
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Courier from '@trycourier/courier';


            const client = new Courier({
              apiKey: process.env['COURIER_API_KEY'], // This is the default and can be omitted
            });


            await client.users.preferences.deleteTopic('topic_id', { user_id:
            'user_id' });
        - lang: Python
          source: |-
            import os
            from courier import Courier

            client = Courier(
                api_key=os.environ.get("COURIER_API_KEY"),  # This is the default and can be omitted
            )
            client.users.preferences.delete_topic(
                topic_id="topic_id",
                user_id="user_id",
            )
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\n\t\"github.com/trycourier/courier-go\"\n\t\"github.com/trycourier/courier-go/option\"\n)\n\nfunc main() {\n\tclient := courier.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\terr := client.Users.Preferences.DeleteTopic(\n\t\tcontext.TODO(),\n\t\t\"topic_id\",\n\t\tcourier.UserPreferenceDeleteTopicParams{\n\t\t\tUserID: \"user_id\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n"
        - lang: Java
          source: >-
            package com.courier.example;


            import com.courier.client.CourierClient;

            import com.courier.client.okhttp.CourierOkHttpClient;

            import
            com.courier.models.users.preferences.PreferenceDeleteTopicParams;


            public final class Main {
                private Main() {}

                public static void main(String[] args) {
                    CourierClient client = CourierOkHttpClient.fromEnv();

                    PreferenceDeleteTopicParams params = PreferenceDeleteTopicParams.builder()
                        .userId("user_id")
                        .topicId("topic_id")
                        .build();
                    client.users().preferences().deleteTopic(params);
                }
            }
        - lang: Ruby
          source: >-
            require "courier"


            courier = Courier::Client.new(api_key: "My API Key")


            result = courier.users.preferences.delete_topic("topic_id", user_id:
            "user_id")


            puts(result)
        - lang: PHP
          source: >-
            <?php


            require_once dirname(__DIR__) . '/vendor/autoload.php';


            use Courier\Client;

            use Courier\Core\Exceptions\APIException;


            $client = new Client(apiKey: getenv('COURIER_API_KEY') ?: 'My API
            Key');


            try {
              $result = $client->users->preferences->deleteTopic(
                'topic_id', userID: 'user_id', tenantID: 'tenant_id'
              );

              var_dump($result);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: C#
          source: |-
            using TryCourier;
            using TryCourier.Models.Users.Preferences;

            CourierClient client = new();

            PreferenceDeleteTopicParams parameters = new()
            {
                UserID = "user_id",
                TopicID = "topic_id",
            };

            await client.Users.Preferences.DeleteTopic(parameters);
        - lang: CLI
          source: |-
            courier users:preferences delete-topic \
              --api-key 'My API Key' \
              --user-id user_id \
              --topic-id topic_id
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````