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

# Create Target

> Creates a Web Application, API, or Network target in your organization, optionally with credentials and API authentication instructions.



## OpenAPI

````yaml /openapi.json post /v1/targets
openapi: 3.1.0
info:
  title: MindFort API
  version: 1.0.0
  description: >-
    The MindFort Public API supports targets, Discovery, assessments, finding
    lifecycle and analytics, and reports. Informational probe results are
    labeled `secured`.
servers:
  - url: https://api.mindfort.app
    description: Production
security:
  - bearerAuth: []
paths:
  /v1/targets:
    post:
      tags:
        - Targets
      summary: Create Target
      description: >-
        Creates a Web Application, API, or Network target in your organization,
        optionally with credentials and API authentication instructions.
      operationId: createTarget
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateTargetRequest'
      responses:
        '201':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicTarget'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Not permitted for this organization
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: A target already exists for this domain or IP address
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    CreateTargetRequest:
      type: object
      required:
        - name
        - target_type
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 255
          pattern: \S
        description:
          type:
            - string
            - 'null'
          maxLength: 4000
        target_type:
          type: string
          enum:
            - web_app
            - api
            - network
        web_domain:
          type:
            - string
            - 'null'
          format: uri
          minLength: 1
          maxLength: 2083
          pattern: ^[Hh][Tt][Tt][Pp][Ss]?://
          description: >-
            HTTP(S) target URL required for web_app and api. URL-embedded
            credentials are rejected; use target credentials instead. A
            host-only URL may be returned with a trailing slash.
        ip_address:
          type:
            - string
            - 'null'
          format: ip-address
        api_auth_instructions:
          type:
            - string
            - 'null'
          maxLength: 10000
          description: >-
            API authentication validation instructions. Required when an API
            target is created with one or more credentials.
        credentials:
          type: array
          items:
            $ref: '#/components/schemas/TargetCredentialCreateRequest'
          default: []
      allOf:
        - if:
            properties:
              target_type:
                const: network
            required:
              - target_type
          then:
            required:
              - ip_address
            properties:
              web_domain:
                type: 'null'
              credentials:
                maxItems: 0
          else:
            required:
              - web_domain
            properties:
              ip_address:
                type: 'null'
        - if:
            properties:
              target_type:
                const: api
              credentials:
                minItems: 1
            required:
              - target_type
              - credentials
          then:
            required:
              - api_auth_instructions
            properties:
              api_auth_instructions:
                type: string
                minLength: 1
                pattern: \S
      additionalProperties: false
    PublicTarget:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        name:
          type: string
          title: Name
        description:
          title: Description
          type:
            - string
            - 'null'
        target_type:
          type: string
          title: Target Type
        web_domain:
          title: Web Domain
          type:
            - string
            - 'null'
        ip_address:
          title: Ip Address
          type:
            - string
            - 'null'
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
        last_assessment_time:
          title: Last Assessment Time
          type:
            - string
            - 'null'
          format: date-time
        api_auth_instructions:
          type:
            - string
            - 'null'
          maxLength: 10000
          description: Target-level API authentication validation instructions.
        created_by:
          anyOf:
            - type: string
              enum:
                - user
                - mindfort
            - type: 'null'
          title: Created By
        created_by_user_id:
          type:
            - string
            - 'null'
          title: Created By User Id
        origin_suggestion_id:
          type:
            - string
            - 'null'
          format: uuid
          title: Origin Suggestion Id
      type: object
      required:
        - id
        - name
        - target_type
        - created_at
        - updated_at
      title: PublicTarget
      additionalProperties: false
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Human-readable error message
        code:
          type: string
          description: Stable machine-readable error code when one is available
        request_id:
          type: string
          description: Unique request identifier for debugging
    TargetCredentialCreateRequest:
      type: object
      required:
        - credential_name
        - credential_type
      properties:
        credential_name:
          type: string
          minLength: 1
          maxLength: 255
        credential_type:
          type: string
          enum:
            - application_login
            - magic_link
            - email_mfa
            - authenticator_2fa
            - sms_mfa
            - sms_login
            - api_key
        username:
          type:
            - string
            - 'null'
          maxLength: 255
          description: Username for login credential types. Optional for email_mfa.
        password:
          type:
            - string
            - 'null'
          minLength: 1
          maxLength: 255
          writeOnly: true
          description: Password for login credential types. Optional for email_mfa.
        role:
          type: string
          enum:
            - user
            - admin
            - viewer
            - editor
            - custom
          default: user
        description:
          type:
            - string
            - 'null'
          maxLength: 4000
        login_instructions:
          type:
            - string
            - 'null'
          maxLength: 10000
        additional_auth_instructions:
          type:
            - string
            - 'null'
          maxLength: 10000
          description: >-
            Instructions specific to this credential, used during
            authentication. Plain text only; HTML tags and unsupported control
            characters are rejected.
        pending_email_id:
          type:
            - string
            - 'null'
          format: uuid
        authenticator_2fa_secret:
          type:
            - string
            - 'null'
          minLength: 1
          maxLength: 255
          writeOnly: true
        api_key_credential:
          anyOf:
            - $ref: '#/components/schemas/APIKeyCredentialInput'
            - type: 'null'
          writeOnly: true
        sms_country_code:
          type:
            - string
            - 'null'
          pattern: ^[A-Za-z]{2}$
      additionalProperties: false
    APIKeyCredentialInput:
      type: object
      writeOnly: true
      required:
        - secret
      properties:
        secret:
          type: string
          minLength: 1
          writeOnly: true
        placement:
          $ref: '#/components/schemas/APIKeyPlacementInput'
        additional_fields:
          type:
            - object
            - 'null'
          additionalProperties:
            type: string
      additionalProperties: false
    APIKeyPlacementInput:
      type: object
      properties:
        kind:
          type: string
          enum:
            - bearer
            - header
            - query
            - json_body
          default: header
        header_name:
          type:
            - string
            - 'null'
          maxLength: 255
          description: Valid only for header placement; defaults to X-API-Key.
        query_param:
          type:
            - string
            - 'null'
          maxLength: 255
          description: Valid only for query placement; defaults to api_key.
        json_field_path:
          type:
            - string
            - 'null'
          maxLength: 500
          description: >-
            Required for json_body placement; not accepted for other placement
            kinds.
        bearer_prefix:
          type:
            - string
            - 'null'
          maxLength: 100
          description: >-
            Valid only for bearer placement; defaults to Bearer followed by a
            space.
        extra_headers:
          type:
            - object
            - 'null'
          additionalProperties:
            type: string
      additionalProperties: false
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key generated from the MindFort dashboard. Pass as `Authorization:
        Bearer <your-api-key>`.

````

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