> ## Documentation Index
> Fetch the complete documentation index at: https://dodopayments-mintlify-external-integration-datafast-autosen.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Deactivate License

> This endpoint allows you to deactivate a license for the user.

<Info>
  **No API Key Required**: This is a public endpoint that does not require authentication. You can call it directly from client applications, desktop software, or CLIs to deactivate license keys without exposing your API credentials.
</Info>


## OpenAPI

````yaml post /licenses/deactivate
openapi: 3.1.0
info:
  title: public
  description: ''
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
  version: 1.61.5
servers:
  - url: https://test.dodopayments.com/
    description: Test Mode Server Host
  - url: https://live.dodopayments.com/
    description: Live Mode Server Host
security: []
tags:
  - name: Products
  - name: Payments
  - name: Subscriptions
  - name: Addons
  - name: Customers
  - name: Refunds
  - name: Disputes
  - name: Events
  - name: License Keys
  - name: Licenses
  - name: Discounts
  - name: Meters
  - name: Outgoing Webhooks
  - name: Checkout
  - name: Webhook Events
paths:
  /licenses/deactivate:
    post:
      tags:
        - Licenses
      operationId: deactivate_license_key
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeactivateLicenseKeyRequest'
        required: true
      responses:
        '200':
          description: License key instance deactivated successfully
        '403':
          description: >-
            License key instance not found or does not belong to this license
            key
        '404':
          description: License key not found
        '500':
          description: Something went wrong :(
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import DodoPayments from 'dodopayments';

            const client = new DodoPayments({
              bearerToken: 'My Bearer Token',
            });

            await client.licenses.deactivate({
              license_key: 'license_key',
              license_key_instance_id: 'license_key_instance_id',
            });
        - lang: Python
          source: |-
            from dodopayments import DodoPayments

            client = DodoPayments(
                bearer_token="My Bearer Token",
            )
            client.licenses.deactivate(
                license_key="license_key",
                license_key_instance_id="license_key_instance_id",
            )
        - lang: Go
          source: |
            package main

            import (
              "context"

              "github.com/dodopayments/dodopayments-go"
              "github.com/dodopayments/dodopayments-go/option"
            )

            func main() {
              client := dodopayments.NewClient(
                option.WithBearerToken("My Bearer Token"),
              )
              err := client.Licenses.Deactivate(context.TODO(), dodopayments.LicenseDeactivateParams{
                LicenseKey: dodopayments.F("license_key"),
                LicenseKeyInstanceID: dodopayments.F("license_key_instance_id"),
              })
              if err != nil {
                panic(err.Error())
              }
            }
        - lang: Java
          source: |-
            package com.dodopayments.api.example;

            import com.dodopayments.api.client.DodoPaymentsClient;
            import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
            import com.dodopayments.api.models.licenses.LicenseDeactivateParams;

            public final class Main {
                private Main() {}

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

                    LicenseDeactivateParams params = LicenseDeactivateParams.builder()
                        .licenseKey("license_key")
                        .licenseKeyInstanceId("license_key_instance_id")
                        .build();
                    client.licenses().deactivate(params);
                }
            }
        - lang: Kotlin
          source: |-
            package com.dodopayments.api.example

            import com.dodopayments.api.client.DodoPaymentsClient
            import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient
            import com.dodopayments.api.models.licenses.LicenseDeactivateParams

            fun main() {
                val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()

                val params: LicenseDeactivateParams = LicenseDeactivateParams.builder()
                    .licenseKey("license_key")
                    .licenseKeyInstanceId("license_key_instance_id")
                    .build()
                client.licenses().deactivate(params)
            }
        - lang: Ruby
          source: |-
            require "dodopayments"

            dodo_payments = Dodopayments::Client.new(
              bearer_token: "My Bearer Token",
              environment: "test_mode" # defaults to "live_mode"
            )

            result = dodo_payments.licenses.deactivate(
              license_key: "license_key",
              license_key_instance_id: "license_key_instance_id"
            )

            puts(result)
components:
  schemas:
    DeactivateLicenseKeyRequest:
      type: object
      required:
        - license_key
        - license_key_instance_id
      properties:
        license_key:
          type: string
        license_key_instance_id:
          type: string

````