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

# Image classification

> Run inference on classification models hosted on Epigos AI.

Once your models are deployed on the Epigos AI platform, they come with a readily accessible REST API.




## OpenAPI

````yaml post /predict/classify/{model_id}/
openapi: 3.0.0
info:
  title: Epigos API
  version: 0.1.0
  contact:
    name: Epigos Support
    email: hello@epigos.ai
    url: https://epigos.ai/contact
  termsOfService: https://epigos.ai/terms
  license:
    name: MIT
    url: https://raw.githubusercontent.com/Epigos-AI/docs/main/LICENSE
  description: |-
    Epigos AI API reference documentation.
    Our API is still very much a work in product and subject to change.
servers:
  - url: https://api.epigos.ai
security:
  - APIKeyHeader: []
  - APIKeyQuery: []
paths:
  /predict/classify/{model_id}/:
    post:
      tags:
        - Prediction
      summary: Image classification
      description: >
        Run inference on classification models hosted on Epigos AI.


        Once your models are deployed on the Epigos AI platform, they come with
        a readily accessible REST API.
      parameters:
        - name: model_id
          in: path
          required: true
          example: 5581982d-721c-4e3c-b863-da2d985364a2
          description: >-
            The unique ID of your model deployed on Epigos AI. You can find it
            in the web dashboard by viewing the model details.
          schema:
            type: string
            format: uuid
            title: Model Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ClassificationIn'
            examples:
              Predict Image URL:
                value:
                  image: https://example.org/image.jpg
              Predict Base64 encoded image:
                value:
                  image: base64
              Predict with confidence threshold:
                value:
                  image: https://example.org/image.jpg
                  confidence: 0.7
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClassificationResult'
              examples:
                Image classification:
                  value:
                    category: cat
                    confidence: 0.854
                    predictions:
                      - category: cat
                        confidence: 0.854
                      - category: dog
                        confidence: 0.146
        '400':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '401':
          description: Unauthorized Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPUnauthorizedError'
components:
  schemas:
    ClassificationIn:
      description: >-
        You can POST a base64 encoded image directly to your model endpoint. Or
        you can pass a URL as the image parameter in the request body if image
        is already hosted elsewhere
      properties:
        image:
          type: string
          title: Image
          description: >-
            Image path to run predictions on. It can be base64 encoded string or
            URL to the image.
          example: https://example.org/image.jpg
        confidence:
          type: number
          maximum: 1
          minimum: 0
          title: Confidence
          description: The confidence threshold used to filter out predictions
          nullable: false
          example: 0.7
      additionalProperties: false
      type: object
      required:
        - image
      title: ClassificationIn
    ClassificationResult:
      description: >
        The API inference route hosted by us returns a JSON object that includes
        a predictions array. Each prediction within this array comprises the
        following attributes:
      properties:
        category:
          type: string
          title: Category
          description: Predicted category of the image
        confidence:
          type: number
          title: Confidence
          description: highest predicted confidence score
        predictions:
          items:
            $ref: '#/components/schemas/ClassificationPrediction'
          type: array
          title: Predictions
          description: >-
            collection of all predicted classes and their associated confidence
            values for the prediction
      additionalProperties: false
      type: object
      required:
        - category
        - confidence
      title: ClassificationResult
    HTTPValidationError:
      title: Bad Request
      description: Bad Request (HTTP 400).
      properties:
        type:
          type: string
          description: '`error`.'
          enum:
            - error
          example: error
        code:
          type: string
          description: '`bad_request`.'
          example: bad_request
          enum:
            - bad_request
        status:
          type: integer
          description: '`400`.'
          example: 400
          enum:
            - 400
        message:
          type: string
          description: >-
            Describes the fields that are missing or incorrectly formatted in
            the API

            request.
          example: Missing '****' field
        details:
          type: array
          description: >-
            A list of detail objects that further clarify the reason for the
            error.
          items:
            $ref: '#/components/schemas/ErrorDetail'
    HTTPUnauthorizedError:
      title: Unauthorized Error
      description: Unauthorized Error (HTTP 401)
      properties:
        type:
          type: string
          description: '`error`.'
          enum:
            - error
          example: error
        code:
          type: string
          description: '`unauthorized`.'
          example: unauthorized
          enum:
            - unauthorized
        status:
          type: integer
          description: '`401`.'
          example: 401
          enum:
            - 401
        message:
          type: string
          description: No valid API authentication found.
          example: Invalid or missing credentials
          enum:
            - Invalid or missing credentials
        details:
          type: array
          example: []
          description: >-
            A list of detail objects that further clarify the reason for the
            error.
          items:
            $ref: '#/components/schemas/ErrorDetail'
    ClassificationPrediction:
      properties:
        category:
          type: string
          title: Category
          description: the label of the classification
        confidence:
          type: number
          title: Confidence
          description: >-
            the model's confidence that the image contains objects of the
            detected classification
      additionalProperties: false
      type: object
      required:
        - category
        - confidence
      title: ClassificationPrediction
    ErrorDetail:
      description: Additional detail about the part of a request body that caused an issue
      properties:
        location:
          type: string
          example: body
          description: The location where the error caused an issue.
          enum:
            - query
            - body
            - path
            - header
        type:
          type: string
          example: value_error.missing
          description: A unique identifier for the type of error that occurred.
        pointer:
          type: string
          example: /image
          description: >-
            The exact item for which the validation did not succeed. This is a
            JSON

            pointer for request bodies, while for query, path, and header
            parameters

            it is the name of the parameter.
        message:
          type: string
          example: field required
          description: A human readable message for this error detail.
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
      description: Your API key (obtained via your workspace API settings page)
    APIKeyQuery:
      type: apiKey
      in: query
      name: api-key
      description: Your API key (obtained via your workspace API settings page)

````