> ## 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.

# Undelete Credit Entitlement

> Restores a previously deleted credit entitlement



## OpenAPI

````yaml post /credit-entitlements/{id}/undelete
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:
  /credit-entitlements/{id}/undelete:
    post:
      tags:
        - Credit Entitlements
      summary: Restores a previously deleted credit entitlement.
      description: >-
        Undeletes a soft-deleted credit entitlement by clearing `deleted_at`,

        making it available again through standard list and get endpoints.


        # Authentication

        Requires an API key with `Editor` role.


        # Path Parameters

        - `id` - The unique identifier of the credit entitlement to restore
        (format: `cde_...`)


        # Responses

        - `200 OK` - Credit entitlement restored successfully

        - `500 Internal Server Error` - Database error, entitlement not found,
        or entitlement is not deleted


        # Business Logic

        - Only deleted credit entitlements can be restored

        - The query filters for `deleted_at IS NOT NULL`, so non-deleted
        entitlements will result in 0 rows affected

        - If no rows are affected (entitlement doesn't exist, doesn't belong to
        business, or is not deleted), returns 500

        - The `updated_at` timestamp is automatically updated on successful
        restoration

        - Once restored, the entitlement becomes immediately available in the
        standard list and get endpoints

        - All configuration settings are preserved during delete/restore
        operations


        # Error Handling

        This endpoint returns 500 Internal Server Error in several cases:

        - The credit entitlement does not exist

        - The credit entitlement belongs to a different business

        - The credit entitlement is not currently deleted (already active)


        Callers should verify the entitlement exists and is deleted before
        calling this endpoint.
      operationId: undelete_credit_entitlement
      parameters:
        - name: id
          in: path
          description: Credit Entitlement ID
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Credit Entitlement Restored Successfully
        '500':
          description: Something went wrong :(
      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
            });

            await client.creditEntitlements.undelete('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
            )
            client.credit_entitlements.undelete(
                "id",
            )
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\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\terr := client.CreditEntitlements.Undelete(context.TODO(), \"id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\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.creditentitlements.CreditEntitlementUndeleteParams;


            public final class Main {
                private Main() {}

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

                    client.creditEntitlements().undelete("id");
                }
            }
        - 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.creditentitlements.CreditEntitlementUndeleteParams


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

                client.creditEntitlements().undelete("id")
            }
        - 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.credit_entitlements.undelete("id")

            puts(result)
        - 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 {
              $result = $client->creditEntitlements->undelete('id');

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

            DodoPaymentsClient client = new();

            CreditEntitlementUndeleteParams parameters = new() { ID = "id" };

            await client.CreditEntitlements.Undelete(parameters);
components:
  securitySchemes:
    API_KEY:
      type: http
      scheme: bearer

````