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

# Create mission

> Create a new mission definition



## OpenAPI

````yaml https://us-central-1.telnyxcloudstorage.com/clawd-docs/openapi/ai/missions.yml post /ai/missions
openapi: 3.1.0
info:
  title: Telnyx AI Missions API
  version: 2.0.0
  description: >-
    API for tracking multi-step AI agent activities with missions, runs, plans,
    and events.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
paths:
  /ai/missions:
    post:
      tags:
        - Missions
      summary: Create mission
      description: Create a new mission definition
      operationId: post_public_missions_missions
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateMissionRequest'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MissionResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      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 mission = await client.ai.missions.create({ name: 'name' });

            console.log(mission.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
            )
            mission = client.ai.missions.create(
                name="name",
            )
            print(mission.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\tmission, err := client.AI.Missions.New(context.TODO(), telnyx.AIMissionNewParams{\n\t\tName: \"name\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", mission.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.ai.missions.MissionCreateParams;
            import com.telnyx.sdk.models.ai.missions.MissionCreateResponse;

            public final class Main {
                private Main() {}

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

                    MissionCreateParams params = MissionCreateParams.builder()
                        .name("name")
                        .build();
                    MissionCreateResponse mission = client.ai().missions().create(params);
                }
            }
        - lang: Ruby
          source: |-
            require "telnyx"

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

            mission = telnyx.ai.missions.create(name: "name")

            puts(mission)
components:
  schemas:
    CreateMissionRequest:
      properties:
        name:
          type: string
          title: Name
        description:
          title: Description
          type: string
        model:
          title: Model
          type: string
        instructions:
          title: Instructions
          type: string
        execution_mode:
          $ref: '#/components/schemas/ExecutionMode'
          default: external
        metadata:
          title: Metadata
          additionalProperties: true
          type: object
      type: object
      required:
        - name
      title: CreateMissionRequest
    MissionResponse:
      properties:
        data:
          $ref: '#/components/schemas/MissionData'
      type: object
      required:
        - data
      title: MissionResponse
    HTTPValidationError:
      title: HTTPValidationError
      type: object
      properties:
        detail:
          title: Detail
          type: array
          items:
            $ref: '#/components/schemas/ValidationError'
    ExecutionMode:
      type: string
      enum:
        - external
        - managed
      title: ExecutionMode
    MissionData:
      properties:
        mission_id:
          type: string
          format: uuid
          title: Mission Id
        name:
          type: string
          title: Name
        description:
          title: Description
          type: string
        model:
          title: Model
          type: string
        instructions:
          title: Instructions
          type: string
        execution_mode:
          $ref: '#/components/schemas/ExecutionMode'
        metadata:
          title: Metadata
          additionalProperties: true
          type: object
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
        - mission_id
        - name
        - execution_mode
        - created_at
        - updated_at
      title: MissionData
    ValidationError:
      title: ValidationError
      required:
        - loc
        - msg
        - type
      type: object
      properties:
        loc:
          title: Location
          type: array
          items:
            anyOf:
              - type: string
              - type: integer
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````