> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trestleiq.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Phone Feedback API

> Phone Feedback API offers a method of providing feedback to Trestle about dialed numbers for their connected/disconnected status and confirmation of right party contact.

<Panel>
  <RequestExample>
    ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
    curl --location --request POST "https://api.trestleiq.com/1.0/phone_feedback" \
      --header "x-api-key: YOUR_API_KEY" \
      --header "Content-Type: application/json" \
      --data '{
        "response_id": "T_b5d031b8-e8a3-4eef-8fa8-d87d3b7e386f",
        "phone": "2069735100",
        "name": "Waidong Syrws",
        "phone_status": "Connected",
        "phone_right_party_contact": true
      }'
    ```

    ```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
    const response = await fetch("https://api.trestleiq.com/1.0/phone_feedback", {
      method: "POST",
      headers: {
        "x-api-key": "YOUR_API_KEY",
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        response_id: "T_b5d031b8-e8a3-4eef-8fa8-d87d3b7e386f",
        phone: "2069735100",
        name: "Waidong Syrws",
        phone_status: "Connected",
        phone_right_party_contact: true,
      }),
    });
    const data = await response.json();
    ```

    ```javascript Node.js theme={"theme":{"light":"github-light","dark":"github-dark"}}
    import axios from "axios";

    const { data } = await axios.post(
      "https://api.trestleiq.com/1.0/phone_feedback",
      {
        response_id: "T_b5d031b8-e8a3-4eef-8fa8-d87d3b7e386f",
        phone: "2069735100",
        name: "Waidong Syrws",
        phone_status: "Connected",
        phone_right_party_contact: true,
      },
      {
        headers: {
          "x-api-key": "YOUR_API_KEY",
        },
      }
    );
    console.log(data);
    ```

    ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
    import requests

    headers = {
        "x-api-key": "YOUR_API_KEY",
        "Content-Type": "application/json",
    }

    payload = {
        "response_id": "T_b5d031b8-e8a3-4eef-8fa8-d87d3b7e386f",
        "phone": "2069735100",
        "name": "Waidong Syrws",
        "phone_status": "Connected",
        "phone_right_party_contact": True,
    }

    response = requests.post(
        "https://api.trestleiq.com/1.0/phone_feedback",
        json=payload,
        headers=headers,
        timeout=30,
    )
    data = response.json()
    print(data)
    ```

    ```csharp C# theme={"theme":{"light":"github-light","dark":"github-dark"}}
    using var client = new HttpClient();
    client.DefaultRequestHeaders.Add("x-api-key", "YOUR_API_KEY");

    var payload = new
    {
      response_id = "T_b5d031b8-e8a3-4eef-8fa8-d87d3b7e386f",
      phone = "2069735100",
      name = "Waidong Syrws",
      phone_status = "Connected",
      phone_right_party_contact = true
    };

    var response = await client.PostAsJsonAsync("https://api.trestleiq.com/1.0/phone_feedback", payload);
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
    ```

    ```go Go theme={"theme":{"light":"github-light","dark":"github-dark"}}
    package main

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

    func main() {
    	jsonBody := []byte(`{
        "response_id": "T_b5d031b8-e8a3-4eef-8fa8-d87d3b7e386f",
        "phone": "2069735100",
        "name": "Waidong Syrws",
        "phone_status": "Connected",
        "phone_right_party_contact": true
      }`)

    	req, _ := http.NewRequest("POST", "https://api.trestleiq.com/1.0/phone_feedback", bytes.NewBuffer(jsonBody))
    	req.Header.Set("x-api-key", "YOUR_API_KEY")
    	req.Header.Set("Content-Type", "application/json")

    	resp, err := http.DefaultClient.Do(req)
    	if err != nil {
    		panic(err)
    	}
    	defer resp.Body.Close()

    	fmt.Println(resp.StatusCode)
    }
    ```

    ```php PHP theme={"theme":{"light":"github-light","dark":"github-dark"}}
    <?php
    $payload = [
      "response_id" => "T_b5d031b8-e8a3-4eef-8fa8-d87d3b7e386f",
      "phone" => "2069735100",
      "name" => "Waidong Syrws",
      "phone_status" => "Connected",
      "phone_right_party_contact" => true
    ];

    $curl = curl_init("https://api.trestleiq.com/1.0/phone_feedback");
    curl_setopt($curl, CURLOPT_HTTPHEADER, [
      "x-api-key: YOUR_API_KEY",
      "Content-Type: application/json"
    ]);
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($payload));
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

    $response = curl_exec($curl);
    curl_close($curl);

    echo $response;
    ```

    ```java Java theme={"theme":{"light":"github-light","dark":"github-dark"}}
    import java.net.URI;
    import java.net.http.HttpClient;
    import java.net.http.HttpRequest;
    import java.net.http.HttpResponse;

    public class PhoneFeedbackExample {
      public static void main(String[] args) throws Exception {
        String body =
            """
            {
              "response_id": "T_b5d031b8-e8a3-4eef-8fa8-d87d3b7e386f",
              "phone": "2069735100",
              "name": "Waidong Syrws",
              "phone_status": "Connected",
              "phone_right_party_contact": true
            }
            """;

        HttpRequest request =
            HttpRequest.newBuilder()
                .uri(URI.create("https://api.trestleiq.com/1.0/phone_feedback"))
                .header("x-api-key", "YOUR_API_KEY")
                .header("Content-Type", "application/json")
                .POST(HttpRequest.BodyPublishers.ofString(body))
                .build();

        HttpResponse<String> response =
            HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
      }
    }
    ```
  </RequestExample>

  <ResponseExample>
    ```json Response Example theme={"theme":{"light":"github-light","dark":"github-dark"}}
    {
      "status": "success",
      "error": {
        "name": "InternalError",
        "message": "Could not retrieve entire response"
      }
    }
    ```
  </ResponseExample>
</Panel>

## Phone Feedback 1.0

Phone Feedback API allows you to submit phone feedback, including phone status and whether the phone number belongs to the right party based on a live call.

## Headers

<ParamField path="x-api-key" body="header" type="string" required>
  Your API key for authentication. **Example:** `{{ apiKey }}`
</ParamField>

## Request Body

<ParamField path="response_id" body="json" type="string" required>
  The response ID returned from a prior Trestle API call. **Example:**
  `T_b5d031b8-e8a3-4eef-8fa8-d87d3b7e386f`
</ParamField>

<ParamField path="phone" body="json" type="string" required>
  The phone number in E.164 or local format. The default country calling code is
  +1 (USA). **Example:** `2069735100`
</ParamField>

<ParamField path="name" body="json" type="string">
  Person or business name associated with the phone number. **Example:**
  `Waidong Syrws`
</ParamField>

<ParamField path="phone_status" body="json" type="string" required>
  Live-call status for the phone number. Possible values: `Connected` or
  `Disconnected`. **Example:** `Connected` Enum: <Badge>Connected</Badge> <Badge>Disconnected</Badge>
</ParamField>

<ParamField path="phone_right_party_contact" body="json" type="boolean" required>
  Indicates if the call confirmed the number belongs to the right party.
  **Example:** `true`
</ParamField>

## Response

<ResponseField name="status" type="string">
  Indicates whether the feedback was received successfully. **Example:**
  `success`
</ResponseField>

<ResponseField name="error" type="object(PartialError)">
  Error details in case of an error.

  <Expandable title="error object">
    <ResponseField name="name" type="string">
      Incomplete response due to external timeouts. **value:** "InternalError"
    </ResponseField>

    <ResponseField name="message" type="string">
      The error message. **value:** "Could not retrieve entire response"
    </ResponseField>
  </Expandable>
</ResponseField>

<Danger>
  ## Error Responses

  ### 400 Bad Request

  The server cannot process the request due to client-side errors.

  Check for: Syntax errors in the request script, malformed JSON, or invalid parameters.

  ### 403 Forbidden

  The request is understood, but the server is refusing to fulfill it. Error responses include an `errorCode` field identifying the cause:

  * **Invalid API Key** (`INVALID_API_KEY`): The key is incorrect, deactivated, or missing from the request.

    Check for: Trailing spaces, syntax errors, incorrect character counts, or a missing `x-api-key` header.

  * **API Key Disabled (Portal Issue)** (`FORBIDDEN`): The key is inactive.

    Check for: Insufficient funds in your self-serve wallet or if a Trestle Admin manually deactivated your API key.

  * **API Key does not have Product Access (Portal Issue)** (`FORBIDDEN`): The API key is active, but it is not enabled for this product or API version.

    Check for: Incorrect endpoint, incorrect API version, or missing product access on the key.

  * **API Key Expired** (`FORBIDDEN`): The key has reached its end-of-life (primarily affects Trial users).

  ### 429 Too Many Requests

  You have sent too many requests in a given amount of time.

  * **Rate Limit Exceeded** (`RATE_LIMIT_EXCEEDED`): You have surpassed the queries-per-second (QPS) threshold for your tier.

  * **Quota Exceeded (Portal Issue)** (`QUOTA_EXCEEDED`): You have reached the total volume allowed for your current billing cycle. Upgrade your plan in the portal to resume service.

  ### 500 Internal Server Error

  An unexpected error occurred on the server side. Please contact support if this persists.

  See [Error handling](/guides/errors) for all error response bodies and codes.
</Danger>
