---
updatedAt: 2026-11-05T23:25:26.000Z
agentTools:
  siteIndex: https://docs.recurly.com/llms.txt
  projectIndex: https://docs.recurly.com/recurly-subscriptions/v2021-02-25/llms.txt
---

# Delete an uninvoiced line item

# OpenAPI definition

````json
{
  "openapi": "3.0.0",
  "info": {
    "title": "Recurly V3 API",
    "description": "# Getting Started\n\n## Versioning\nThe V3 API is versioned to allow stability for integrators and\nflexibility for Recurly to continue making improvements.\n\nThe versions follow a format that incorporates the approximate date the\nchanges were released in a YYYY-MM-DD format, e.g. `v2021-02-25`.\n\n> *WARNING*: Specifying a version is required to get a successful response.\n\nEach request should specify a version using the `Accept` header:\n* `Accept: application/vnd.recurly.v2021-02-25`\n* `Accept: application/vnd.recurly.v2021-02-25+json`\n\nAll responses will include a `Recurly-Version` header with the API version\nused to process the request:\n```\nRecurly-Version: recurly.v2021-02-25\n```\n\nRecurly's client libraries correspond with API versions as listed below.\n\n<table>\n  <tr>\n    <th>API Version</th>\n    <th>Client Library Version</th>\n  </tr>\n  <tr>\n    <td>v2021-02-25</td>\n    <td>4.x</td>\n  </tr>\n  <tr>\n    <td>v2019-10-10</td>\n    <td>3.x</td>\n  </tr>\n</table>\n\nClient library releases:\n\n* [Node.js](https://github.com/recurly/recurly-client-node/releases)\n* [Python](https://github.com/recurly/recurly-client-python/releases)\n* [.NET](https://github.com/recurly/recurly-client-dotnet/releases)\n* [Ruby](https://github.com/recurly/recurly-client-ruby/releases)\n* [Java](https://github.com/recurly/recurly-client-java/releases)\n* [PHP](https://github.com/recurly/recurly-client-php/releases)\n* [Go](https://github.com/recurly/recurly-client-go/releases)\n\nClient libraries follow semantic versioning. For example, [Ruby client library\nversion 3.18.1](https://github.com/recurly/recurly-client-ruby/releases/tag/3.18.1)\nrepresents major version `3`, minor version `18` with patch `1`.\n\nWe encourage you to update to the latest version of the API and corresponding client library,\nas most recent versions are more performant than their predecessors. See the\n[changelog](https://recurly.com/developers/api/changelog.html) for a comprehensive list of changes\nintroduced in the latest API version.\n\n### Default Versions\nSpecifying a version is required to get a successful response. If you wish to\nreceive the latest version and are willing to accept the risk of breaking changes,\nyou may specify a version of `latest`.\n\nThe following media types will default the newest version of\nthe API:\n\n* `application/vnd.recurly.latest`\n* `application/vnd.recurly.latest+json`\n\n### Deprecation\nResponses for a deprecated version request will return two headers:\n```\nRecurly-Deprecated: TRUE\nRecurly-Sunset-Date: 2017-06-01T00:00:00+00:00\n```\nThe sunset date is an ISO-8601 formatted date time after which the version\nwill no longer be accessible.\n\n### Unsupported Versions\nA request for an unsupported version will return a status code of 406 and\nthe body will include a list of supported versions:\n```\n{\n  \"error\": {\n    \"type\": \"invalid_api_version\",\n    \"message\": \"That accept header isn't in the format we use to specify an API version. Try one of these instead:\",\n    \"acceptable_accept_headers\": [\n      \"application/vnd.recurly.v2016-03-01\",\n      \"application/vnd.recurly.v2016-04-27\",\n      \"application/vnd.recurly.v2016-07-27\",\n      \"application/vnd.recurly.v2016-12-15\",\n      \"application/vnd.recurly.v2017-01-12\",\n      \"application/vnd.recurly.v2017-09-30\",\n      \"application/vnd.recurly.v2018-01-24\",\n      \"application/vnd.recurly.v2018-05-10\",\n      \"application/vnd.recurly.v2018-06-06\",\n      \"application/vnd.recurly.v2018-08-09\",\n      \"application/vnd.recurly.v2019-10-10\",\n      \"application/vnd.recurly.v2021-02-25\"\n    ]\n  }\n}\n```\n\n## Error Messages\nError messages sent via the Recurly API are generally directed at\ndevelopers and those who are familiar with API technology. When using the\nAPI and passing error messages to target systems, be mindful that\nthese messages may not make sense in the context of the target system.\nPlease consider changing these messages in the target system to be better\nsuited to the audience of the system.\n\nPlease see [transaction error codes](https://recurly.com/developers/pages/api-transaction-errors.html) for more details.\n\n## Pagination\n### Response Schema\nEvery GET listing endpoint returns a response with the same schema:\n\n```\n{\n  \"object\":   \"list\",         // Always \"list\"\n  \"has_more\": true,           // false if this is the last page of data\n  \"next\":     \"https://...\",  // A URL pointing to the next page of data\n  \"data\":     []              // The data for this page as an array\n}\n```\n\nTo page through every record, your code should continually call the URL\nat `next` until `has_more` is `false`.\n\n### Query Parameters\nMost GET listing endpoints take query parameters that allow filtering\nand sorting the results. Some endpoints have additional parameters, which are\ndocumented on the respective endpoints, but most support the\nfollowing parameters:\n\n* `ids`: A comma separated list of ids to match.\n* `limit`: The number of records to return per page.\n* `order`: The sort order of records.\n* `sort`: The date field to use in sorting.\n* `begin_time`: The start datetime to filter (ISO 8601).\n* `end_time`: The end datetime to filter (ISO 8601).\n\n### Counting with HEAD\nEvery GET listing endpoint also supports the HEAD HTTP method. Making a\nhead request to the endpoint results in an empty body and an additional\n`Recurly-Total-Records` header. This is a count of the total number of records\nthat the endpoint will return, taking into account the current filtering query\nparameters.\n\n## Limits\nIn order to provide a fast response time to all our customers, we may rate\nlimit excessive requests. By default, new Recurly sites have the following\nAPI rate limits:\n\n* Sandbox sites: 400 requests/min. All requests count towards the rate limit.\n* Production sites: 1,000 requests/min. Only GET requests count towards the rate limit.\n\nOnce your site moves into production mode, Recurly will only rate limit\nGET requests. New subscriptions, account modifications, and other requests\nusing POST, PUT, or DELETE methods will not count against your rate limit.\n\nThe rate limit is calculated over a sliding 5 minute window. This means a\nproduction site could make 4,000 requests within one minute and not hit\nthe rate limit so long as the site made less than 1,000 requests during\nthe prior 4 minutes.\n\nIf an API request exceeds the rate limit, the API will return a\n`429 Too Many Requests` HTTP status. If your business needs a higher\nlimit, please contact support.\n\nThe rate limit applied to your client can be determined with the\n`X-RateLimit-Limit` header, and the number of remaining requests is sent\nin the `X-RateLimit-Remaining` header. Finally, the `X-RateLimit-Reset`\nheader contains an integer value representing the time, measured in\nseconds since the UNIX Epoch, at which the request count will be reset.\n\n## Idempotent Requests\n\nRecurly supports idempotent requests via the `Idempotency-Key` header for\n`POST`, `PUT`, `PATCH`, and `DELETE` requests. This allows API clients to\nsafely retry these requests without risk of duplicate operations.\n\nWhen you send a request with an `Idempotency-Key` header, Recurly stores the\nresponse for **1 hour**. If you send an identical request (same key, method,\npath, and API key) within that window, Recurly replays the original response\nrather than processing a new one. The replay response includes an\n`Idempotency-Prior: true` header.\n\nIf a request with the same key is **already in flight** when a second arrives,\nthe server returns `409 Conflict` with `Recurly-Should-Retry: true` and a\n`Retry-After` header indicating how long to wait in seconds before retrying.\n\n> **Note:** `429 Too Many Requests` responses are intentionally **not** cached.\n> You may retry freely once your rate limit resets without risk of unintended\n> replay behavior.\n\nKeys must be **255 characters or fewer**. Keys exceeding this limit will\nreceive a `400 Bad Request` response. We recommend using a UUID v4 as your\nkey to guarantee uniqueness.\n\n> **SDK support:** Native `Idempotency-Key` management (automatic key\n> generation, retry handling, and replay detection) is currently supported only\n> in the **Ruby SDK**. When using other SDKs or raw HTTP clients, you must\n> supply and manage the `Idempotency-Key` header yourself.\n\n## Change Log\n\nA list of changes for this version can be found [in the changelog](https://recurly.com/developers/api/changelog.html#v2021-02-25---current-ga-version).\n",
    "version": "v2021-02-25"
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "x-tagGroups": [
    {
      "name": "Customers",
      "tags": [
        "Account",
        "Account Note",
        "Account Acquisition Info",
        "Billing Info",
        "Billing Infos",
        "Coupon Redemption",
        "Subscription",
        "Subscription Change",
        "Usage",
        "Shipping Address"
      ]
    },
    {
      "name": "Invoices and Payments",
      "tags": [
        "Purchase",
        "Invoice",
        "Line Item",
        "Credit Payment",
        "Transaction",
        "Revenue Recovery",
        "Gift Cards"
      ]
    },
    {
      "name": "Products and Promotions",
      "tags": [
        "Item",
        "Plan",
        "Add-on",
        "Measured Unit",
        "Coupon",
        "Unique Coupon Code",
        "Price Segment"
      ]
    },
    {
      "name": "Configuration",
      "tags": [
        "Site",
        "Custom Field Definition",
        "Shipping Method",
        "Dunning Campaigns",
        "Business Entities",
        "Automated Exports",
        "General Ledger Account",
        "Performance Obligations",
        "Invoice Templates"
      ]
    },
    {
      "name": "App Management",
      "tags": [
        "External Subscription",
        "External Invoice",
        "External Product",
        "External Account",
        "External Product Reference",
        "External Payment Phase"
      ]
    }
  ],
  "tags": [
    {
      "name": "Line Item",
      "description": "Line items are the charges and credits on your customer's invoices."
    }
  ],
  "paths": {
    "/line_items/{line_item_id}": {
      "delete": {
        "tags": [
          "Line Item"
        ],
        "operationId": "remove_line_item",
        "summary": "Delete an uninvoiced line item",
        "parameters": [
          {
            "$ref": "#/components/parameters/accept_header"
          },
          {
            "$ref": "#/components/parameters/line_item_id"
          }
        ],
        "responses": {
          "204": {
            "description": "Line item deleted."
          },
          "404": {
            "description": "Incorrect site or line item ID.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Only pending line items can be deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Unexpected error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-code-samples": [
          {
            "lang": "Node.js",
            "source": "try {\n  await client.removeLineItem(lineItemId)\n  console.log('Removed line item: ', lineItemId)\n} catch (err) {\n  if (err instanceof recurly.errors.NotFoundError) {\n    // If the request was not found, you may want to alert the user or\n    // just return null\n    console.log('Resource Not Found')\n  } else {\n    // If we don't know what to do with the err, we should\n    // probably re-raise and let our web framework and logger handle it\n    console.log('Unknown Error: ', err)\n  }\n}\n"
          },
          {
            "lang": "Python",
            "source": "try:\n    client.remove_line_item(line_item_id)\n    print(\"Removed LineItem %s\" % line_item_id)\nexcept recurly.errors.NotFoundError:\n    # If the resource was not found, you may want to alert the user or\n    # just return nil\n    print(\"Resource Not Found\")\n"
          },
          {
            "lang": ".NET",
            "source": "try\n{\n    client.RemoveLineItem(lineItemId);\n    Console.WriteLine($\"Removed line item {lineItemId}\");\n}\ncatch (Recurly.Errors.Validation ex)\n{\n    // If the request was not valid, you may want to tell your user\n    // why. You can find the invalid params and reasons in ex.Error.Params\n    Console.WriteLine($\"Failed validation: {ex.Error.Message}\");\n}\ncatch (Recurly.Errors.ApiError ex)\n{\n    // Use ApiError to catch a generic error from the API\n    Console.WriteLine($\"Unexpected Recurly Error: {ex.Error.Message}\");\n}\n"
          },
          {
            "lang": "Ruby",
            "source": "begin\n  @client.remove_line_item(\n    line_item_id: line_item_id\n  )\n  puts \"Removed LineItem #{line_item_id}\"\nrescue Recurly::Errors::NotFoundError\n  # If the resource was not found, you may want to alert the user or\n  # just return nil\n  puts \"Resource Not Found\"\nend\n"
          },
          {
            "lang": "Java",
            "source": "try {\n    client.removeLineItem(lineItemId);\n    System.out.println(\"Removed line item \" + lineItemId);\n} catch (ValidationException e) {\n    // If the request was not valid, you may want to tell your user\n    // why. You can find the invalid params and reasons in e.getError().getParams()\n    System.out.println(\"Failed validation: \" + e.getError().getMessage());\n} catch (ApiException e) {\n    // Use ApiException to catch a generic error from the API\n    System.out.println(\"Unexpected Recurly Error: \" + e.getError().getMessage());\n}\n"
          },
          {
            "lang": "PHP",
            "source": "try {\n    $client->removeLineItem($line_item_id);\n    echo 'Removed LineItem: ' . $line_item_id . PHP_EOL;\n} catch (\\Recurly\\Errors\\Validation $e) {\n    // If the request was not valid, you may want to tell your user\n    // why. You can find the invalid params and reasons in err.params\n    var_dump($e);\n} catch (\\Recurly\\RecurlyError $e) {\n    // If we don't know what to do with the err, we should\n    // probably re-raise and let our web framework and logger handle it\n    var_dump($e);\n}\n"
          },
          {
            "lang": "Go",
            "source": "lineItem, err := client.RemoveLineItem(lineItemID)\nif e, ok := err.(*recurly.Error); ok {\n\tif e.Type == recurly.ErrorTypeNotFound {\n\t\tfmt.Printf(\"Resource not found: %v\", e)\n\t\treturn nil, err\n\t}\n\tfmt.Printf(\"Unexpected Recurly error: %v\", e)\n\treturn nil, err\n}\nfmt.Printf(\"Removed Line Item: %v\", lineItem)"
          }
        ],
        "x-readme": {
          "code-samples": [
            {
              "language": "node",
              "code": "try {\n  await client.removeLineItem(lineItemId)\n  console.log('Removed line item: ', lineItemId)\n} catch (err) {\n  if (err instanceof recurly.errors.NotFoundError) {\n    // If the request was not found, you may want to alert the user or\n    // just return null\n    console.log('Resource Not Found')\n  } else {\n    // If we don't know what to do with the err, we should\n    // probably re-raise and let our web framework and logger handle it\n    console.log('Unknown Error: ', err)\n  }\n}\n",
              "name": "Node.js"
            },
            {
              "language": "python",
              "code": "try:\n    client.remove_line_item(line_item_id)\n    print(\"Removed LineItem %s\" % line_item_id)\nexcept recurly.errors.NotFoundError:\n    # If the resource was not found, you may want to alert the user or\n    # just return nil\n    print(\"Resource Not Found\")\n",
              "name": "Python"
            },
            {
              "language": "csharp",
              "code": "try\n{\n    client.RemoveLineItem(lineItemId);\n    Console.WriteLine($\"Removed line item {lineItemId}\");\n}\ncatch (Recurly.Errors.Validation ex)\n{\n    // If the request was not valid, you may want to tell your user\n    // why. You can find the invalid params and reasons in ex.Error.Params\n    Console.WriteLine($\"Failed validation: {ex.Error.Message}\");\n}\ncatch (Recurly.Errors.ApiError ex)\n{\n    // Use ApiError to catch a generic error from the API\n    Console.WriteLine($\"Unexpected Recurly Error: {ex.Error.Message}\");\n}\n",
              "name": ".NET"
            },
            {
              "language": "ruby",
              "code": "begin\n  @client.remove_line_item(\n    line_item_id: line_item_id\n  )\n  puts \"Removed LineItem #{line_item_id}\"\nrescue Recurly::Errors::NotFoundError\n  # If the resource was not found, you may want to alert the user or\n  # just return nil\n  puts \"Resource Not Found\"\nend\n",
              "name": "Ruby"
            },
            {
              "language": "java",
              "code": "try {\n    client.removeLineItem(lineItemId);\n    System.out.println(\"Removed line item \" + lineItemId);\n} catch (ValidationException e) {\n    // If the request was not valid, you may want to tell your user\n    // why. You can find the invalid params and reasons in e.getError().getParams()\n    System.out.println(\"Failed validation: \" + e.getError().getMessage());\n} catch (ApiException e) {\n    // Use ApiException to catch a generic error from the API\n    System.out.println(\"Unexpected Recurly Error: \" + e.getError().getMessage());\n}\n",
              "name": "Java"
            },
            {
              "language": "php",
              "code": "try {\n    $client->removeLineItem($line_item_id);\n    echo 'Removed LineItem: ' . $line_item_id . PHP_EOL;\n} catch (\\Recurly\\Errors\\Validation $e) {\n    // If the request was not valid, you may want to tell your user\n    // why. You can find the invalid params and reasons in err.params\n    var_dump($e);\n} catch (\\Recurly\\RecurlyError $e) {\n    // If we don't know what to do with the err, we should\n    // probably re-raise and let our web framework and logger handle it\n    var_dump($e);\n}\n",
              "name": "PHP"
            },
            {
              "language": "go",
              "code": "lineItem, err := client.RemoveLineItem(lineItemID)\nif e, ok := err.(*recurly.Error); ok {\n\tif e.Type == recurly.ErrorTypeNotFound {\n\t\tfmt.Printf(\"Resource not found: %v\", e)\n\t\treturn nil, err\n\t}\n\tfmt.Printf(\"Unexpected Recurly error: %v\", e)\n\treturn nil, err\n}\nfmt.Printf(\"Removed Line Item: %v\", lineItem)",
              "name": "Go"
            }
          ]
        }
      }
    }
  },
  "servers": [
    {
      "url": "https://v3.recurly.com"
    },
    {
      "url": "https://v3.eu.recurly.com"
    }
  ],
  "components": {
    "parameters": {
      "accept_header": {
        "name": "Accept",
        "in": "header",
        "description": "The API version to use for this request, e.g. `application/vnd.recurly.v2021-02-25`. Requests without a versioned `Accept` header return a 406 response.",
        "required": true,
        "schema": {
          "default": "application/vnd.recurly.v2021-02-25",
          "type": "string",
          "enum": [
            "application/vnd.recurly.v2021-02-25",
            "application/vnd.recurly.v2021-02-25+json"
          ]
        }
      },
      "line_item_id": {
        "name": "line_item_id",
        "in": "path",
        "description": "Line Item ID.",
        "required": true,
        "schema": {
          "type": "string"
        }
      }
    },
    "securitySchemes": {
      "api_key": {
        "type": "http",
        "description": "Enter the API key as the username and set the password to an empty string. You can locate and manage your API keys from the [API Credentials](https://app.recurly.com/go/developer/api_keys) page.",
        "scheme": "basic"
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "type": {
            "title": "Type",
            "type": "string",
            "enum": [
              "bad_request",
              "immutable_subscription",
              "internal_server_error",
              "invalid_api_key",
              "invalid_api_version",
              "invalid_content_type",
              "invalid_permissions",
              "invalid_token",
              "missing_feature",
              "not_found",
              "rate_limited",
              "service_not_available",
              "simultaneous_request",
              "tax_service_error",
              "transaction",
              "unauthorized",
              "unavailable_in_api_version",
              "unknown_api_version",
              "validation"
            ]
          },
          "message": {
            "type": "string",
            "title": "Message"
          },
          "params": {
            "type": "array",
            "title": "Parameter specific errors",
            "items": {
              "type": "object",
              "properties": {
                "param": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }
  }
}
````

# Sibling pages

* [List an account's line items](https://docs.recurly.com/recurly-subscriptions/v2021-02-25/reference/list_account_line_items.md)
* [Create a new line item for the account](https://docs.recurly.com/recurly-subscriptions/v2021-02-25/reference/create_line_item.md)
* [List an invoice's line items](https://docs.recurly.com/recurly-subscriptions/v2021-02-25/reference/list_invoice_line_items.md)
* [List a site's line items](https://docs.recurly.com/recurly-subscriptions/v2021-02-25/reference/list_line_items.md)
* [Fetch a line item](https://docs.recurly.com/recurly-subscriptions/v2021-02-25/reference/get_line_item.md)
* [List a subscription's line items](https://docs.recurly.com/recurly-subscriptions/v2021-02-25/reference/list_subscription_line_items.md)