# Get Alert by id

GET http://localhost:5173/api/v1/private/alerts/{id}

Get Alert by id

Reference: https://www.comet.com/docs/opik/reference/rest-api/alerts/get-alert-by-id

## OpenAPI Specification

```yaml
openapi: 3.1.1
info:
  title: Get Alert by id
  version: endpoint_alerts.getAlertById
paths:
  /v1/private/alerts/{id}:
    get:
      operationId: get-alert-by-id
      summary: Get Alert by id
      description: Get Alert by id
      tags:
        - - subpackage_alerts
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Alert resource
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Alert_Public'
        '404':
          description: Not Found
          content: {}
components:
  schemas:
    AlertPublicAlertType:
      type: string
      enum:
        - value: general
        - value: slack
        - value: pagerduty
    Webhook_Public:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        url:
          type: string
        secret_token:
          type: string
        headers:
          type: object
          additionalProperties:
            type: string
        created_at:
          type: string
          format: date-time
        created_by:
          type: string
        last_updated_at:
          type: string
          format: date-time
        last_updated_by:
          type: string
      required:
        - url
    AlertTriggerPublicEventType:
      type: string
      enum:
        - value: trace:errors
        - value: trace:feedback_score
        - value: trace_thread:feedback_score
        - value: prompt:created
        - value: prompt:committed
        - value: trace:guardrails_triggered
        - value: prompt:deleted
        - value: experiment:finished
        - value: trace:cost
        - value: trace:latency
    AlertTriggerConfigPublicType:
      type: string
      enum:
        - value: scope:project
        - value: threshold:feedback_score
        - value: threshold:cost
        - value: threshold:latency
        - value: threshold:errors
    AlertTriggerConfig_Public:
      type: object
      properties:
        id:
          type: string
          format: uuid
        alert_trigger_id:
          type: string
          format: uuid
        type:
          $ref: '#/components/schemas/AlertTriggerConfigPublicType'
        config_value:
          type: object
          additionalProperties:
            type: string
        created_at:
          type: string
          format: date-time
        created_by:
          type: string
        last_updated_at:
          type: string
          format: date-time
        last_updated_by:
          type: string
      required:
        - type
    AlertTrigger_Public:
      type: object
      properties:
        id:
          type: string
          format: uuid
        alert_id:
          type: string
          format: uuid
        event_type:
          $ref: '#/components/schemas/AlertTriggerPublicEventType'
        trigger_configs:
          type: array
          items:
            $ref: '#/components/schemas/AlertTriggerConfig_Public'
        created_at:
          type: string
          format: date-time
        created_by:
          type: string
      required:
        - event_type
    Alert_Public:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        enabled:
          type: boolean
        alert_type:
          $ref: '#/components/schemas/AlertPublicAlertType'
        metadata:
          type: object
          additionalProperties:
            type: string
        webhook:
          $ref: '#/components/schemas/Webhook_Public'
        triggers:
          type: array
          items:
            $ref: '#/components/schemas/AlertTrigger_Public'
        created_at:
          type: string
          format: date-time
        created_by:
          type: string
        last_updated_at:
          type: string
          format: date-time
        last_updated_by:
          type: string
      required:
        - webhook

```

## SDK Code Examples

```python
import requests

url = "http://localhost:5173/api/v1/private/alerts/id"

response = requests.get(url)

print(response.json())
```

```javascript
const url = 'http://localhost:5173/api/v1/private/alerts/id';
const options = {method: 'GET'};

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 := "http://localhost:5173/api/v1/private/alerts/id"

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

	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("http://localhost:5173/api/v1/private/alerts/id")

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

request = Net::HTTP::Get.new(url)

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

```java
HttpResponse<String> response = Unirest.get("http://localhost:5173/api/v1/private/alerts/id")
  .asString();
```

```php
<?php

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'http://localhost:5173/api/v1/private/alerts/id');

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

```csharp
var client = new RestClient("http://localhost:5173/api/v1/private/alerts/id");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "http://localhost:5173/api/v1/private/alerts/id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"

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()
```