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

# Get AI Coding Batch Job Results

> Retrieves the current status and results of a batch coding job



## OpenAPI

````yaml GET /api/v1/coding/{batchJobId}
openapi: 3.0.0
info:
  title: Followup Generation API
  version: 1.0.0
  description: API for generating followup questions based on survey responses
  contact:
    name: API Support
    email: justin@getaftercare.com
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
  - url: https://surveys.getaftercare.com
    description: Production server
  - url: https://staging.aftercareai.com
    description: Staging server
security:
  - ApiKeyAuth: []
tags:
  - name: Followups
    description: Operations related to followup question generation
  - name: Data Quality
    description: Operations related to response data quality evaluation
  - name: Coding
    description: Operations related to coding survey responses
paths:
  /api/v1/coding/{batchJobId}:
    get:
      tags:
        - Coding
      summary: Get batch coding job status
      description: Retrieves the current status and results of a batch coding job
      operationId: getBatchCodingJobStatus
      parameters:
        - name: batchJobId
          in: path
          required: true
          description: ID of the batch coding job to check
          schema:
            type: string
      responses:
        '200':
          description: Batch coding job status retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BatchCodingResponse'
              example:
                batchJobId: 123e4567-e89b-12d3-a456-426614174000
                surveyIdentifier: CSAT-2024-Q1
                status: completed
                results:
                  completedAt: '2024-03-12T15:30:45Z'
                  questionCodes:
                    - questionIdentifier: Q1
                      question: What did you like about our service?
                      responseCodes:
                        - id: 1
                          label: Customer Service Quality
                          responses:
                            - responseIdentifier: '12345'
                              answer: >-
                                The customer service representatives were very
                                helpful and resolved my issue quickly.
                          subCodes:
                            - id: 11
                              label: Staff Helpfulness
                              responses:
                                - responseIdentifier: '12345'
                                  answer: >-
                                    The customer service representatives were
                                    very helpful and resolved my issue quickly.
                              subCodes: []
                        - id: 2
                          label: Delivery
                          responses:
                            - responseIdentifier: '12346'
                              answer: >-
                                I liked the easy-to-use website and fast
                                delivery.
                          subCodes: []
                  nextCursor: null
        '400':
          description: Bad request - invalid input parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                code: INVALID_REQUEST
                message: Invalid batch job ID format
        '403':
          description: Forbidden - Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                code: INVALID_API_KEY
                message: Invalid or missing API key
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                code: NOT_FOUND
                message: Batch job not found
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                code: INTERNAL_ERROR
                message: An unexpected error occurred
        '504':
          description: Gateway timeout
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                code: GATEWAY_TIMEOUT
                message: The server took too long to respond
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: JavaScript
          source: >-
            const response = await
            api.coding.getBatchJobStatus('123e4567-e89b-12d3-a456-426614174000');
        - lang: Python
          source: >-
            response =
            api.coding.get_batch_job_status('123e4567-e89b-12d3-a456-426614174000')
components:
  schemas:
    BatchCodingResponse:
      type: object
      required:
        - batchJobId
        - surveyIdentifier
        - status
      properties:
        batchJobId:
          type: string
          description: Unique identifier for the coding job
          example: 123e4567-e89b-12d3-a456-426614174000
        surveyIdentifier:
          type: string
          description: Unique identifier for the survey
          example: CSAT-2024-Q1
        status:
          $ref: '#/components/schemas/BatchCodingStatus'
          description: Status of the batch job that determines the structure of results
        results:
          oneOf:
            - $ref: '#/components/schemas/BatchCodingSuccess'
              title: Success Response
              description: Present when status is 'completed'
            - $ref: '#/components/schemas/BatchCodingErrorDetails'
              title: Error Response
              description: Present when status is 'partial_failure' or 'total_failure'
          description: >-
            The results structure depends on the status value. If the job is
            successful, the results will be a list of question codes with a
            hierarchical tree of codes and subcodes. If the job fails, the
            results will be the error details.
          discriminator:
            propertyName: status
            mapping:
              completed: '#/components/schemas/BatchCodingSuccess'
              partial_failure: '#/components/schemas/BatchCodingErrorDetails'
              total_failure: '#/components/schemas/BatchCodingErrorDetails'
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: Error code
          example: INVALID_REQUEST
        message:
          type: string
          description: Error message
          example: Invalid request parameters
        details:
          type: object
          description: Additional error details
          example:
            question: Question is required
    BatchCodingStatus:
      type: string
      enum:
        - queued
        - processing
        - completed
        - partial_failure
        - total_failure
      description: >-
        Status values for the batch processing job.


        * `queued` - Job has been received but processing has not yet started

        * `processing` - Job is currently being processed

        * `completed` - Job has finished processing successfully

        * `partial_failure` - Job has finished processing with some failures

        * `total_failure` - Job encountered an error during processing and did
        not complete any results.
    BatchCodingSuccess:
      type: object
      required:
        - completedAt
        - questionCodes
      properties:
        completedAt:
          type: string
          format: date-time
          description: When the batch job completed processing
          example: '2024-03-12T15:30:45Z'
        questionCodes:
          type: array
          description: >-
            Coding results organized by question identifier. Each question will
            have its own hierarchical category tree.
          items:
            $ref: '#/components/schemas/QuestionCodeData'
        nextCursor:
          type: string
          nullable: true
          description: >-
            Cursor for the next page of results. Null if there are no more
            results.
          example: null
    BatchCodingErrorDetails:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: Error code identifying the type of failure
          example: PROCESSING_ERROR
        message:
          type: string
          description: Description of the error
          example: Failed to process survey responses
    QuestionCodeData:
      type: object
      required:
        - questionIdentifier
        - question
        - responseCodes
      properties:
        questionIdentifier:
          type: string
          description: Unique identifier for the question.
          example: Q1
        question:
          type: string
          description: The question text.
          example: What did you like about our service?
        responseCodes:
          type: array
          description: >-
            Hierarchical code tree for this specific question. Codes can have
            subcodes forming a tree structure.
          items:
            $ref: '#/components/schemas/ResponseCode'
    ResponseCode:
      type: object
      required:
        - id
        - label
        - responses
        - subCodes
      properties:
        id:
          type: integer
          description: Unique identifier for this code
          example: 1
        label:
          type: string
          description: Label of the code
          example: Customer Service Quality
        responses:
          type: array
          description: The responses that were classified into this code
          items:
            $ref: '#/components/schemas/ResponseEntry'
        subCodes:
          type: array
          description: >-
            More specific codes classified under this code that can be used to
            further classify the responses
          items:
            $ref: '#/components/schemas/ResponseCode'
    ResponseEntry:
      type: object
      required:
        - responseIdentifier
        - answer
      properties:
        responseIdentifier:
          type: string
          description: Unique identifier for this response entry
          example: resp-123
        answer:
          type: string
          description: The respondent's answer to the question
          example: I really enjoy the battery life.
        followupResponses:
          type: array
          description: Any follow-up question/answer pairs for this response
          items:
            $ref: '#/components/schemas/FollowupResponse'
    FollowupResponse:
      type: object
      required:
        - question
        - answer
      properties:
        question:
          type: string
          description: The follow-up question that was asked
          example: What features of our product stood out most?
        answer:
          type: string
          description: The answer provided to the follow-up
          example: I loved the night-vision mode.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-Aftercare-Key
      description: API key for authentication

````