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

# List License Keys

> Retrieve a list of license keys associated with your account.

<Warning>
  **Deprecated API**: License keys are now managed through the [Entitlements](/features/entitlements/introduction) system. Use [List Grants](/api-reference/entitlements/list-grants) to list issued license keys (filter with `integration_type=license_key`); each grant carries its `license_key` details. This endpoint will be removed in a future release.
</Warning>


## OpenAPI

````yaml get /license_keys
openapi: 3.1.0
info:
  title: public
  description: ''
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
  version: 1.102.0
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: Entitlements
  - name: Licenses
  - name: Discounts
  - name: Meters
  - name: Credit Entitlements
  - name: Credit Entitlement Balances
  - name: Outgoing Webhooks
  - name: Checkout
  - name: Webhook Events
paths:
  /license_keys:
    get:
      tags:
        - License Keys
      operationId: list_license_keys_handler
      parameters:
        - name: page_size
          in: query
          description: Page size default is 10 max is 100
          required: false
          schema:
            type: integer
            format: int32
            minimum: 0
          style: form
        - name: page_number
          in: query
          description: Page number default is 0
          required: false
          schema:
            type: integer
            format: int32
            minimum: 0
          style: form
        - name: customer_id
          in: query
          description: Filter by customer ID
          required: false
          schema:
            type: string
          style: form
        - name: status
          in: query
          description: Filter by license key status
          required: false
          schema:
            type: string
            enum:
              - active
              - expired
              - disabled
          style: form
        - name: product_id
          in: query
          description: Filter by product ID
          required: false
          schema:
            type: string
          style: form
        - name: created_at_gte
          in: query
          description: Filter license keys created on or after this timestamp
          required: false
          schema:
            type: string
            format: date-time
          style: form
        - name: created_at_lte
          in: query
          description: Filter license keys created on or before this timestamp
          required: false
          schema:
            type: string
            format: date-time
          style: form
        - name: source
          in: query
          description: Filter by license key source
          required: false
          schema:
            type: string
            enum:
              - auto
              - import
              - manual
          style: form
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListLicenseKeysResponse'
        '500':
          description: Something went wrong :(
      deprecated: true
      security:
        - API_KEY: []
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import DodoPayments from 'dodopayments';

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

            // Automatically fetches more pages as needed.
            for await (const licenseKey of client.licenseKeys.list()) {
              console.log(licenseKey.id);
            }
        - lang: Python
          source: |-
            import os
            from dodopayments import DodoPayments

            client = DodoPayments(
                bearer_token=os.environ.get("DODO_PAYMENTS_API_KEY"),  # This is the default and can be omitted
            )
            page = client.license_keys.list()
            page = page.items[0]
            print(page.id)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/dodopayments/dodopayments-go\"\n\t\"github.com/dodopayments/dodopayments-go/option\"\n)\n\nfunc main() {\n\tclient := dodopayments.NewClient(\n\t\toption.WithBearerToken(\"My Bearer Token\"),\n\t)\n\tpage, err := client.LicenseKeys.List(context.TODO(), dodopayments.LicenseKeyListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n"
        - 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.licensekeys.LicenseKeyListPage;
            import com.dodopayments.api.models.licensekeys.LicenseKeyListParams;

            public final class Main {
                private Main() {}

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

                    LicenseKeyListPage page = client.licenseKeys().list();
                }
            }
        - 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.licensekeys.LicenseKeyListPage
            import com.dodopayments.api.models.licensekeys.LicenseKeyListParams

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

                val page: LicenseKeyListPage = client.licenseKeys().list()
            }
        - lang: Ruby
          source: |-
            require "dodopayments"

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

            page = dodo_payments.license_keys.list

            puts(page)
        - lang: PHP
          source: |-
            <?php

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

            use Dodopayments\Client;
            use Dodopayments\Core\Exceptions\APIException;

            $client = new Client(
              bearerToken: getenv('DODO_PAYMENTS_API_KEY') ?: 'My Bearer Token',
              environment: 'test_mode',
            );

            try {
              $page = $client->licenseKeys->list(
                createdAtGte: new \DateTimeImmutable('2019-12-27T18:11:19.117Z'),
                createdAtLte: new \DateTimeImmutable('2019-12-27T18:11:19.117Z'),
                customerID: 'customer_id',
                pageNumber: 0,
                pageSize: 0,
                productID: 'product_id',
                source: 'auto',
                status: 'active',
              );

              var_dump($page);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: C#
          source: |-
            using System;
            using DodoPayments.Client;
            using DodoPayments.Client.Models.LicenseKeys;

            DodoPaymentsClient client = new();

            LicenseKeyListParams parameters = new();

            var page = await client.LicenseKeys.List(parameters);
            await foreach (var item in page.Paginate())
            {
                Console.WriteLine(item);
            }
components:
  schemas:
    ListLicenseKeysResponse:
      type: object
      required:
        - items
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/LicenseKeyResponse'
    LicenseKeyResponse:
      type: object
      required:
        - id
        - business_id
        - key
        - status
        - customer_id
        - product_id
        - instances_count
        - created_at
        - source
      properties:
        activations_limit:
          type:
            - integer
            - 'null'
          format: int32
          description: The maximum number of activations allowed for this license key.
          example: 5
        business_id:
          type: string
          description: >-
            The unique identifier of the business associated with the license
            key.
        created_at:
          type: string
          format: date-time
          description: The timestamp indicating when the license key was created, in UTC.
          example: '2024-01-01T00:00:00Z'
        customer_id:
          type: string
          description: >-
            The unique identifier of the customer associated with the license
            key.
          example: cus_123
        expires_at:
          type:
            - string
            - 'null'
          format: date-time
          description: The timestamp indicating when the license key expires, in UTC.
          example: '2024-12-31T23:59:59Z'
        id:
          type: string
          description: The unique identifier of the license key.
          example: lic_123
        instances_count:
          type: integer
          format: int32
          description: The current number of instances activated for this license key.
        key:
          type: string
          description: The license key string.
        payment_id:
          type:
            - string
            - 'null'
          description: >-
            The unique identifier of the payment associated with the license
            key, if any.
        product_id:
          type: string
          description: >-
            The unique identifier of the product associated with the license
            key.
        source:
          $ref: '#/components/schemas/LicenseKeySource'
          description: >-
            The source of the license key - 'auto' for keys generated by
            payment/subscription flows, 'import' for merchant-imported keys.
        status:
          $ref: '#/components/schemas/LicenseKeyStatus'
          description: >-
            The current status of the license key (e.g., active, inactive,
            expired).
        subscription_id:
          type:
            - string
            - 'null'
          description: >-
            The unique identifier of the subscription associated with the
            license key, if any.
    LicenseKeySource:
      type: string
      enum:
        - auto
        - import
        - manual
    LicenseKeyStatus:
      type: string
      enum:
        - active
        - expired
        - disabled
  securitySchemes:
    API_KEY:
      type: http
      scheme: bearer

````