> ## 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.

# Add an RCS agent test device

> Adds an RCS-capable test number after provider agent creation. Repeating the request for a number already attached to the agent returns the existing test device.



## OpenAPI

````yaml /openapi/source/external/messaging/rcs-registration.json post /rcs/agents/{id}/test_devices
openapi: 3.1.0
info:
  title: Telnyx RCS Registration API
  description: >-
    Create RCS brands and agents, submit them for external review, manage test
    devices, and track carrier launch.
  version: 1.0.0
  contact:
    email: support@telnyx.com
  x-latency-category: responsive
  x-endpoint-cost: light
servers:
  - url: https://api.telnyx.com/v2
    description: Telnyx API v2
security:
  - bearerAuth: []
tags:
  - name: RCS Brands
    description: Manage the legal business entities that operate RCS agents.
  - name: RCS Agents
    description: Manage RCS agent registration, testing, verification, and launch.
paths:
  /rcs/agents/{id}/test_devices:
    post:
      tags:
        - RCS Agents
      summary: Add an RCS agent test device
      description: >-
        Adds an RCS-capable test number after provider agent creation. Repeating
        the request for a number already attached to the agent returns the
        existing test device.
      operationId: AddRcsAgentTestDevice
      parameters:
        - $ref: '#/components/parameters/AgentId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TestDeviceCreateRequest'
      responses:
        '201':
          description: The test device was added or already existed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TestDeviceResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/ValidationError'
        '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 TestDevice = await client.rcs.agents.testDevices.create('id',
            {
              phone_number: 'phone_number',
            });


            console.log(TestDevice.test_device_id);
        - 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
            )
            test_device = client.rcs.agents.test_devices.create(
                id="id",
                phone_number="phone_number",
            )
            print(test_device.test_device_id)
        - 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\ttestDevice, err := client.Rcs.Agents.TestDevices.New(\n\t\tcontext.TODO(),\n\t\t\"id\",\n\t\ttelnyx.RcAgentTestDeviceNewParams{\n\t\t\tPhoneNumber: \"phone_number\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", testDevice.Data)\n}\n"
        - lang: Java
          source: >-
            package com.telnyx.sdk.example;


            import com.telnyx.sdk.client.TelnyxClient;

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

            import
            com.telnyx.sdk.models.rcs.agents.testDevices.TestDeviceCreateParams;


            public final class Main {
                private Main() {}

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

                    TestDeviceCreateParams params = TestDeviceCreateParams.builder()
                        .phoneNumber("phone_number")
                        .build();
                    var response = client.rcs().agents().testDevices().create("id", params);
                }
            }
        - lang: Ruby
          source: >-
            require "telnyx"


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


            test_device = telnyx.rcs.agents.test_devices.create("id",
            phone_number: "phone_number")


            puts(test_device)
        - 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 {
              $test_device = $client->rcs->agents->testDevices->create(
                'id',
                phone_number: 'phone_number',
              );

              var_dump($test_device);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: CLI
          source: |-
            telnyx rcs:agents:test-devices create \
              --api-key 'My API Key' \
              --id id \
              --phone-number phone_number
components:
  parameters:
    AgentId:
      name: id
      in: path
      required: true
      description: The Telnyx-assigned agent identifier.
      schema:
        type: string
        format: uuid
  schemas:
    TestDeviceCreateRequest:
      type: object
      additionalProperties: false
      properties:
        phone_number:
          type: string
          maxLength: 16
          pattern: ^\+[1-9][0-9]{1,14}$
      required:
        - phone_number
      example:
        phone_number: '+13125550123'
    TestDeviceResponse:
      type: object
      additionalProperties: false
      properties:
        test_device_id:
          type: string
          format: uuid
        phone_number:
          type: string
        invite_status:
          $ref: '#/components/schemas/TestDeviceInviteStatus'
      required:
        - test_device_id
        - phone_number
        - invite_status
      example:
        test_device_id: 44444444-4444-4444-8444-444444444444
        phone_number: '+13125550123'
        invite_status: ACCEPTED
    TestDeviceInviteStatus:
      type: string
      enum:
        - PENDING
        - ACCEPTED
        - DECLINED
    ErrorResponse:
      type: object
      properties:
        detail:
          type: string
        errors:
          type: array
          items:
            type: object
            additionalProperties: true
      additionalProperties: true
      example:
        detail: The requested RCS resource was not found.
    ValidationErrorResponse:
      type: object
      properties:
        detail:
          type: array
          items:
            type: object
            properties:
              loc:
                type: array
                items:
                  oneOf:
                    - type: string
                    - type: integer
              msg:
                type: string
              type:
                type: string
            required:
              - loc
              - msg
              - type
      additionalProperties: true
      example:
        detail:
          - loc:
              - body
              - display_name
            msg: Field required
            type: missing
  responses:
    Unauthorized:
      description: The request is not authenticated.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFound:
      description: >-
        The resource does not exist, is not owned by the organization, or the
        provider does not support the requested capability.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Conflict:
      description: >-
        The operation is not allowed in the current lifecycle state or the
        idempotency key was used for a different request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    ValidationError:
      description: The request body or parameters failed validation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ValidationErrorResponse'
    ProviderError:
      description: The RCS provider rejected or could not complete the request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key

````