# List extinctions

GET https://app.launchdarkly.com/api/v2/code-refs/extinctions

Get a list of all extinctions. LaunchDarkly creates an extinction event after you remove all code references to a flag. To learn more, read [About extinction events](https://launchdarkly.com/docs/home/observability/code-references#about-extinction-events).

Reference: https://launchdarkly.com/docs/api/code-references/get-extinctions

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: LaunchDarkly REST API
  version: 1.0.0
paths:
  /api/v2/code-refs/extinctions:
    get:
      operationId: get-extinctions
      summary: List extinctions
      description: >-
        Get a list of all extinctions. LaunchDarkly creates an extinction event
        after you remove all code references to a flag. To learn more, read
        [About extinction
        events](https://launchdarkly.com/docs/home/observability/code-references#about-extinction-events).
      tags:
        - subpackage_codeReferences
      parameters:
        - name: repoName
          in: query
          description: Filter results to a specific repository
          required: false
          schema:
            type: string
            format: string
        - name: branchName
          in: query
          description: >-
            Filter results to a specific branch. By default, only the default
            branch will be queried for extinctions.
          required: false
          schema:
            type: string
            format: string
        - name: projKey
          in: query
          description: Filter results to a specific project
          required: false
          schema:
            type: string
            format: string
        - name: flagKey
          in: query
          description: Filter results to a specific flag key
          required: false
          schema:
            type: string
            format: string
        - name: from
          in: query
          description: >-
            Filter results to a specific timeframe based on commit time,
            expressed as a Unix epoch time in milliseconds. Must be used with
            `to`.
          required: false
          schema:
            type: integer
            format: int64
        - name: to
          in: query
          description: >-
            Filter results to a specific timeframe based on commit time,
            expressed as a Unix epoch time in milliseconds. Must be used with
            `from`.
          required: false
          schema:
            type: integer
            format: int64
        - name: Authorization
          in: header
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Extinction collection response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExtinctionCollectionRep'
        '401':
          description: Invalid access token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedErrorRep'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenErrorRep'
        '429':
          description: Rate limited
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitedErrorRep'
servers:
  - url: https://app.launchdarkly.com
  - url: https://app.launchdarkly.us
components:
  schemas:
    Link:
      type: object
      properties:
        href:
          type: string
          description: The URL of the link
        type:
          type: string
          description: The type of the link
      title: Link
    UnixMillis:
      type: integer
      format: int64
      title: UnixMillis
    Extinction:
      type: object
      properties:
        revision:
          type: string
          description: >-
            The identifier for the revision where flag became extinct. For
            example, a commit SHA.
        message:
          type: string
          description: >-
            Description of the extinction. For example, the commit message for
            the revision.
        time:
          $ref: '#/components/schemas/UnixMillis'
          description: Time of extinction
        flagKey:
          type: string
          description: The feature flag key
        projKey:
          type: string
          description: The project key
      required:
        - revision
        - message
        - time
        - flagKey
        - projKey
      title: Extinction
    ExtinctionCollectionRep:
      type: object
      properties:
        _links:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/Link'
          description: The location and content type of related resources
        items:
          type: object
          additionalProperties:
            type: array
            items:
              $ref: '#/components/schemas/Extinction'
          description: An array of extinction events
      required:
        - _links
        - items
      title: ExtinctionCollectionRep
    UnauthorizedErrorRep:
      type: object
      properties:
        code:
          type: string
          description: Specific error code encountered
        message:
          type: string
          description: Description of the error
      required:
        - code
        - message
      title: UnauthorizedErrorRep
    ForbiddenErrorRep:
      type: object
      properties:
        code:
          type: string
          description: Specific error code encountered
        message:
          type: string
          description: Description of the error
      required:
        - code
        - message
      title: ForbiddenErrorRep
    RateLimitedErrorRep:
      type: object
      properties:
        code:
          type: string
          description: Specific error code encountered
        message:
          type: string
          description: Description of the error
      required:
        - code
        - message
      title: RateLimitedErrorRep
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: Authorization

```

## SDK Code Examples

```python
import requests

url = "https://app.launchdarkly.com/api/v2/code-refs/extinctions"

headers = {"Authorization": "<apiKey>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://app.launchdarkly.com/api/v2/code-refs/extinctions';
const options = {method: 'GET', headers: {Authorization: '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://app.launchdarkly.com/api/v2/code-refs/extinctions"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://app.launchdarkly.com/api/v2/code-refs/extinctions")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://app.launchdarkly.com/api/v2/code-refs/extinctions")
  .header("Authorization", "<apiKey>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://app.launchdarkly.com/api/v2/code-refs/extinctions', [
  'headers' => [
    'Authorization' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://app.launchdarkly.com/api/v2/code-refs/extinctions");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://app.launchdarkly.com/api/v2/code-refs/extinctions")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```