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

# Get research task status

> Polls the status of a previously started asynchronous research task. When the status is `completed`, the response includes the answer and citations. When the status is `failed`, the response includes an error message.



## OpenAPI

````yaml /openapi/source/external/web-search/web-search.json get /web_search/research/{task_id}
openapi: 3.1.0
info:
  version: 1.0.0
  title: Telnyx API
  x-latency-category: interactive
  x-endpoint-cost: light
  description: >-
    Real-time web search, page content retrieval, and deep research with
    citations, exposed through the Telnyx API Gateway and powered by the
    `telnyx-agent-web-search` service.


    ## Authentication


    All endpoints require a Telnyx API key sent as a Bearer token in the
    `Authorization` header. The API Gateway validates the key and forwards the
    verified identity to the backend service as `Telnyx-Auth-Rev2`.


    ## Rate Limits


    Default rate limit: 60 requests per minute per API key.


    ## Error Responses


    Errors follow the format `{ "error": { "message": string, "details": object
    } }`.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
    description: Telnyx API v2
security:
  - bearerAuth: []
tags:
  - name: Web Search
    description: Real-time web search returning structured, LLM-ready JSON results.
  - name: Contents
    description: Page content retrieval for URLs.
  - name: Research
    description: Deep research with citations and async task polling.
paths:
  /web_search/research/{task_id}:
    get:
      tags:
        - Research
      summary: Get research task status
      description: >-
        Polls the status of a previously started asynchronous research task.
        When the status is `completed`, the response includes the answer and
        citations. When the status is `failed`, the response includes an error
        message.
      operationId: GetWebSearchResearchStatus
      parameters:
        - name: task_id
          in: path
          required: true
          description: >-
            The research task ID returned by `POST /web_search/research` with
            `background: true`.
          schema:
            type: string
            maxLength: 200
          example: bf3026a5-dd57-44dd-b922-200041be3a4b
      responses:
        '200':
          description: Research task status.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/ResearchTaskStatus'
              examples:
                completed:
                  summary: Task completed
                  value:
                    data:
                      task_id: bf3026a5-dd57-44dd-b922-200041be3a4b
                      status: completed
                      answer: RAG and fine-tuning serve different purposes...
                      citations:
                        - url: https://arxiv.org/abs/2401.15884
                          title: >-
                            Retrieval-Augmented Generation for
                            Knowledge-Intensive NLP Tasks
                running:
                  summary: Task still running
                  value:
                    data:
                      task_id: bf3026a5-dd57-44dd-b922-200041be3a4b
                      status: running
                failed:
                  summary: Task failed
                  value:
                    data:
                      task_id: bf3026a5-dd57-44dd-b922-200041be3a4b
                      status: failed
                      error: Provider request failed
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '502':
          $ref: '#/components/responses/ProviderError'
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Telnyx from 'telnyx';


            const client = new Telnyx({
              apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
            });


            const response = await
            client.webSearch.research.retrieve('task_id');


            console.log(response.data);
        - lang: Python
          source: |
            import os
            from telnyx import Telnyx

            client = Telnyx(
                api_key=os.environ.get("TELNYX_API_KEY"),  # This is the default and can be omitted
            )
            response = client.web_search.research.retrieve(
                "task_id",
            )
            print(response.data)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/team-telnyx/telnyx-go\"\n\t\"github.com/team-telnyx/telnyx-go/option\"\n)\n\nfunc main() {\n\tclient := telnyx.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresearch, err := client.WebSearch.Research.Get(\n\t\tcontext.TODO(),\n\t\t\"task_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", research.Data)\n}\n"
        - lang: Java
          source: |-
            package com.telnyx.sdk.example;

            import com.telnyx.sdk.client.TelnyxClient;
            import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;

            public final class Main {
                private Main() {}

                public static void main(String[] args) {
                    TelnyxClient client = TelnyxOkHttpClient.fromEnv();

                    var response = client.webSearch().research().retrieve("task_id");
                }
            }
        - lang: Ruby
          source: |-
            require "telnyx"

            telnyx = Telnyx::Client.new(api_key: "My API Key")

            response = telnyx.web_search.research.retrieve("task_id")

            puts(response)
        - lang: PHP
          source: >-
            <?php


            require_once dirname(__DIR__) . '/vendor/autoload.php';


            use Telnyx\Client;

            use Telnyx\Core\Exceptions\APIException;


            $client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API
            Key');


            try {
              $response = $client->webSearch->research->retrieve(
                'task_id',
              );

              var_dump($response);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: CLI
          source: |-
            telnyx web-search:research retrieve \
              --api-key 'My API Key' \
              --task-id bf3026a5-dd57-44dd-b922-200041be3a4b
components:
  schemas:
    ResearchTaskStatus:
      type: object
      required:
        - task_id
        - status
      properties:
        task_id:
          type: string
          description: The research task identifier.
        status:
          type: string
          enum:
            - pending
            - running
            - completed
            - failed
          description: Current status of the research task.
        answer:
          type: string
          description: >-
            The synthesized research answer (present when status is
            `completed`).
        citations:
          type: array
          items:
            $ref: '#/components/schemas/ResearchCitation'
          description: Sources cited in the answer (present when status is `completed`).
        error:
          type:
            - string
            - 'null'
          description: Always present in poll responses; `null` unless the task failed.
    ResearchCitation:
      type: object
      required:
        - url
        - title
      properties:
        url:
          type: string
          format: uri
          description: Source URL.
        title:
          type: string
          description: Title of the source page.
        snippet:
          type: string
          description: Relevant excerpt from the source (if available).
    GatewayError:
      type: object
      description: >-
        Standard Telnyx JSON:API error envelope returned by the API Gateway for
        authentication failures (401).
      required:
        - errors
      properties:
        errors:
          type: array
          items:
            type: object
            required:
              - code
              - title
            properties:
              code:
                type: string
                description: Telnyx error code.
              title:
                type: string
                description: Error title.
              detail:
                type: string
                description: Human-readable error detail.
              source:
                type: object
                properties:
                  pointer:
                    type: string
              meta:
                type: object
                properties:
                  url:
                    type: string
                    format: uri
    WebSearchError:
      type: object
      properties:
        error:
          type: object
          required:
            - message
          properties:
            message:
              type: string
              description: Human-readable error message.
            details:
              type: object
              additionalProperties: true
              description: Additional error details (e.g. validation field errors).
  responses:
    Unauthorized:
      description: >-
        Unauthorized — missing or invalid API key.


        The API Gateway returns this response before the request reaches the
        backend service. The error format follows the standard Telnyx JSON:API
        error envelope with `errors[]`, not the backend-level `WebSearchError`
        shape.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/GatewayError'
          example:
            errors:
              - code: '10009'
                title: Authentication failed
                detail: Could not find any usable credentials in the request.
                meta:
                  url: https://developers.telnyx.com/docs/overview/errors/10009
    NotFound:
      description: >-
        Research task not found. Returned for unknown, malformed, expired, or
        already-purged task IDs.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/WebSearchError'
          example:
            error:
              message: Task not found
    InternalServerError:
      description: Internal server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/WebSearchError'
          example:
            error:
              message: Internal server error
    ProviderError:
      description: The upstream search provider returned an error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/WebSearchError'
          example:
            error:
              message: Provider request failed
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Telnyx API key

````