> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.truvo.com/llms.txt.

# Discover capabilities

GET https://api.truvo.com/v1/capabilities

Reference: https://docs.truvo.com/api-reference/discover-capability

## Authentication

- `Authorization` header (bearer token, required) — Your Truvo API key, sent as a bearer token. The prefix selects sandbox (trv_sandbox_) or live (trv_live_).

## Response

### 200

Supported states, the required-facts schema, and the action types for this caller and environment.

- `line` (enum, required)
  - Allowed values: `personal_auto`, `renters`, `pet`
- `environment` (enum, required)
  - Allowed values: `sandbox`, `live`
- `states` (list of string, required)
- `required_facts` (list of string, required)
- `required_facts_schema` (map from string to any, required)
- `actions` (list of CapabilityAction, required)
- `sandbox` (CapabilitySandbox, required, nullable)
- `quote_disclosure` (QuoteDisclosure, required, nullable) — Truvo's quote disclosure, for a caller without a Truvo key. Null for a caller with a key, which sends its own consent receipt.

## Errors

### 401 Unauthorized Error

Error envelope. One of: authentication_failed.

- `error` (ErrorEnvelopeError, required)
- `request_id` (string, required)

### 403 Forbidden Error

Error envelope. One of: forbidden.

- `error` (ErrorEnvelopeError, required)
- `request_id` (string, required)

### 422 Unprocessable Entity Error

Error envelope. One of: invalid_input.

- `error` (ErrorEnvelopeError, required)
- `request_id` (string, required)

### 429 Too Many Requests Error

Error envelope. One of: rate_limited.

- `error` (ErrorEnvelopeError, required)
- `request_id` (string, required)

### 500 Internal Server Error

Error envelope. One of: internal_error.

- `error` (ErrorEnvelopeError, required)
- `request_id` (string, required)

### 503 Service Unavailable Error

Error envelope. One of: service_unavailable.

- `error` (ErrorEnvelopeError, required)
- `request_id` (string, required)

## Types

### CapabilityAction

- `type` (enum, required)
  - Allowed values: `read_status`, `prepare_purchase`, `open_hosted_checkout`, `continue_on_carrier_site`, `request_assistance`
- `states` (list of string, required)

### CapabilitySandbox

- `scenarios_url` (string, required)

### QuoteDisclosure

Truvo's quote disclosure. A caller without a Truvo key shows the text to the person and sends its version with the quote request once the person agrees.

- `version` (string, required) — The version of Truvo's quote disclosure. New text takes a new version.
- `text` (string, required) — The words to show the person, as written.
- `sha256` (string, required) — The SHA-256 of text, in lowercase hex.
- `privacy_notice_url` (string, required) — Truvo's privacy notice, which the text links.

### ErrorEnvelopeError

- `code` (enum, required)
  - Allowed values: `authentication_failed`, `forbidden`, `not_found`, `invalid_input`, `invalid_json`, `invalid_cursor`, `needs_information`, `conflict`, `quote_expired`, `price_changed`, `purchase_not_supported`, `rate_limited`, `request_too_large`, `internal_error`, `service_unavailable`, `event_cursor_expired`
- `message` (string, required)
- `field_errors` (list of FieldError, required, nullable)
- `retry_action` (RetryAction, required)
- `doc_url` (string, required)

### FieldError

- `path` (string, required)
- `message` (string, required)

### RetryAction

- `type` (enum, required)
  - Allowed values: `none`, `retry`, `correct_input`, `supply_facts`, `read_status`, `use_new_request_key`, `wait`, `contact_support`
- `summary` (string, required)

## Examples

**Response**

```json
{
  "line": "personal_auto",
  "environment": "sandbox",
  "states": [
    "string"
  ],
  "required_facts": [
    "string"
  ],
  "required_facts_schema": {},
  "actions": [
    {
      "type": "read_status",
      "states": [
        "string"
      ]
    }
  ],
  "sandbox": {
    "scenarios_url": "string"
  },
  "quote_disclosure": {
    "version": "string",
    "text": "string",
    "sha256": "string",
    "privacy_notice_url": "string"
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.truvo.com/v1/capabilities"

headers = {"Authorization": "Bearer <token>"}

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

print(response.json())
```

```javascript
const url = 'https://api.truvo.com/v1/capabilities';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

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://api.truvo.com/v1/capabilities"

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

	req.Header.Add("Authorization", "Bearer <token>")

	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://api.truvo.com/v1/capabilities")

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

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

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://api.truvo.com/v1/capabilities")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.truvo.com/v1/capabilities', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.truvo.com/v1/capabilities");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.truvo.com/v1/capabilities")! 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()
```