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

# Generate Agent Objectives

> Generate Agent Objectives with the DialNexa API. Drafts call objectives from your company and customer context without changing an agent.

Read only

Generate Agent Objectives uses your workspace API key. Drafts call objectives from your company and customer context without changing an agent.

## Before you begin

Use a server-side [API key](https://dialnexa.com/docs/api-reference/api-fundamentals.md#authenticate-dialnexa-api-requests) for the intended workspace.

## Generate Agent Objectives request

The request panel lists supported query parameters and body fields. For a request body, the example below supplies the required fields. Replace sample values with your own inputs.

```bash theme={null}
curl --request POST 'https://api.dialnexa.com/v1/agent-builder/generate-objectives' \
  --header "Authorization: Bearer $DIALNEXA_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "company_and_offering": "Acme Corp - B2B payroll software for mid-market HR teams.",
  "target_customer": "HR directors at 200-2,000 employee companies evaluating payroll vendors.",
  "primary_goal": "Book demos and answer pricing and onboarding questions."
}'
```

## Verify the result

Expect HTTP `201`. Read the `data` property in the success envelope; the response panel documents its fields.

This operation also accepts the matching `/v1/assistant` path. The request and result contracts are shared. Use one path consistently for your integration.

## Retry safety

This operation does not modify workspace resources. Retry after a transient connection failure.

## Errors and recovery

* `400`: A field is missing or empty, the context does not contain enough detail to draft objectives ("The given information does not contain enough details to build an agent..."), or no success criteria could be generated. Add detail about what you offer, who you serve, and what the agent should do, then retry.
* `401`: Missing, expired, or invalid API key.

## Related endpoints

* [Get Agent Builder Inventory](https://dialnexa.com/docs/api-reference/v1/agent-builder/inventory.md)
* [Build Agent Configuration](https://dialnexa.com/docs/api-reference/v1/agent-builder/run.md)
* [Stream Agent Build](https://dialnexa.com/docs/api-reference/v1/agent-builder/stream.md)
* [Generate Agent Tone](https://dialnexa.com/docs/api-reference/v1/agent-builder/generate-tone.md)
* [API authentication](https://dialnexa.com/docs/api-reference/api-fundamentals.md#authenticate-dialnexa-api-requests)


## OpenAPI

````yaml POST /v1/agent-builder/generate-objectives
openapi: 3.0.0
info:
  title: DialNexa API
  description: Public `/v1` REST API for the DialNexa voice AI platform.
  version: 1.0.0
servers:
  - url: https://api.dialnexa.com
    description: DialNexa production API
security:
  - bearer: []
tags:
  - name: Agents
  - name: Batch Calls
  - name: Calls
  - name: Knowledge Base
  - name: Languages
  - name: LLMs
  - name: Phone Numbers
  - name: Organization Folders
  - name: Transcribers
  - name: Webhooks
  - name: Voices
  - name: Workflows
  - name: Workflow Leads
  - name: Authentication
  - name: Agent Builder
  - name: Agent Evaluations
paths:
  /v1/agent-builder/generate-objectives:
    post:
      tags:
        - Agent Builder
      summary: Generate Agent Objectives
      description: >-
        Drafts call objectives from your company and customer context without
        changing an agent.
      operationId: generateAgentObjectives
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateObjectives'
            examples:
              request:
                value:
                  company_and_offering: Acme Corp - B2B payroll software for mid-market HR teams.
                  target_customer: >-
                    HR directors at 200-2,000 employee companies evaluating
                    payroll vendors.
                  primary_goal: Book demos and answer pricing and onboarding questions.
      responses:
        '201':
          description: Generated objectives fields
          content:
            application/json:
              schema:
                type: object
                required:
                  - success
                  - error
                  - statusCode
                  - message
                  - data
                  - timestamp
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  error:
                    type: boolean
                    enum:
                      - false
                  statusCode:
                    type: integer
                    example: 201
                  message:
                    type: string
                    example: Success
                  data:
                    type: object
                    properties:
                      success_criteria:
                        type: string
                      information_to_collect:
                        type: string
                      objections_and_faqs:
                        type: string
                  timestamp:
                    type: string
                    format: date-time
        '400':
          description: >-
            A field is missing or empty, the context is too thin to draft
            objectives, or no success criteria could be generated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                notEnoughContext:
                  summary: 400 error
                  value:
                    statusCode: 400
                    error: true
                    success: false
                    data: []
                    message: >-
                      The given information does not contain enough details to
                      build an agent. Tell us what you offer, who you serve, and
                      what the agent should do.
                    errors:
                      - >-
                        The given information does not contain enough details to
                        build an agent. Tell us what you offer, who you serve,
                        and what the agent should do.
        '401':
          description: Missing, expired, or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: 401 error
                  value:
                    statusCode: 401
                    error: true
                    success: false
                    data: []
                    message: Invalid API key
                    errors: []
        '500':
          description: The request could not be completed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: Server error
                  value:
                    statusCode: 500
                    error: true
                    success: false
                    data: []
                    message: Internal server error
                    errors: []
      security:
        - bearer: []
components:
  schemas:
    GenerateObjectives:
      type: object
      properties:
        company_and_offering:
          type: string
          description: Company name and what the business offers
          example: Acme Corp - B2B payroll software for mid-market HR teams.
        target_customer:
          type: string
          description: Who the agent will speak with
          example: >-
            HR directors at 200-2,000 employee companies evaluating payroll
            vendors.
        primary_goal:
          type: string
          description: Primary outcome the agent should achieve on each call
          example: Book demos and answer pricing and onboarding questions.
      required:
        - company_and_offering
        - target_customer
        - primary_goal
    ErrorResponse:
      type: object
      description: Error body on endpoints without response filtering.
      properties:
        statusCode:
          type: integer
          example: 404
        error:
          type: boolean
          enum:
            - true
        success:
          type: boolean
          enum:
            - false
        data:
          oneOf:
            - type: object
              properties:
                code:
                  type: string
                  description: Machine-readable refusal code.
            - type: array
              items: {}
          description: >-
            For a coded refusal, an object with code and the details listed for
            that code. Otherwise an empty array.
        message:
          type: string
        errors:
          type: array
          items:
            type: string
          description: Validation messages for a 400. Empty for other errors.
        validation_errors:
          type: array
          description: >-
            Present when uploaded rows fail number validation (batch and
            workflow lead uploads): one group per distinct error.
          items:
            type: object
            properties:
              error:
                type: string
              rows:
                type: array
                items:
                  type: integer
                description: Row numbers with this error.
              phone_numbers:
                type: array
                items:
                  type: string
        invalid_row_count:
          type: integer
          description: 'Present with validation_errors: how many rows failed.'
      required:
        - statusCode
        - error
        - success
        - data
        - message
        - errors
  securitySchemes:
    bearer:
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.