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

# Classify an image

> Submit an image to be classified as human or artificial.

🔁 Response format varies based on the `Accept` header:

`Accept: application/json` → `{ "identifier": "..." }`

 Other values (e.g. `text/plain`) → plain text with just the identifier string.

**Note:** This endpoint also has an alias available at `/api/classification_image`.



## OpenAPI

````yaml post /api/classification
openapi: 3.0.0
info:
  title: identifAI API
  version: 1.0.0
  description: >-
    API for integrating identifAI's image and video classification
    capabilities.<br><details><summary>**How to obtain your API
    Key**</summary>To obtain your API key, follow these simple steps:  
    <ol><li><p>**Create a user profile and log in to the platform**</p>If you
    don't have an account yet, visit our platform and create a user profile.
    Once you've completed registration and verified your email, log in with your
    credentials.</li><li><p>**Access the user menu**</p>After logging in, click
    on your name or the user icon in the top-right corner of the
    screen.</li><li><p>**Select the API Key option**</p>In the dropdown menu
    that appears, select the "API Key" option. From there, you can view or
    generate your API key.</li></ol>Now you are ready to use your API key in our
    API!</details><details><summary>**How to use the API**</summary>To use the
    API, first make a **POST** request to start the classification. Then, use
    the provided ***identifier*** from the **POST** request to retrieve the
    results.

    <details>

    <summary>**1. Image Classification**</summary>
      * To classify an image, you need to make a **POST** request to `/api/classification` with the required parameters (for details on the parameters, refer to the *"Classification"* section below).
      * In the response, you will receive the ***identifier*** of the classified image.
      * Use the provided ***identifier*** to retrieve the classification results by making a **GET** request to `/api/classification/{identifier}` (for details on how to structure this request, see the *"Classification"* section below).
      * The response will contain the classification results for the image in JSON format.<br>In the response, you will find a ***results*** array, which includes the classification results for each model used, and a ***verdicts*** array, which contains the results for each heuristic applied.<br>If the classification is not yet complete, continue sending the **GET** request until the result is available.</details><details><summary>**2. Video Classification**</summary>
        * To classify a video, you need to make a **POST** request to `/api/classification_video` with the required parameters (for details on the parameters, refer to the *"Classification"* section below).
        * In the response, you will receive the ***identifier*** of the classified video.
        * Use the provided ***identifier*** to retrieve the classification results by making a **GET** request to `/api/classification_video/{identifier}` (for details on how to structure this request, see the *"Classification"* section below).
        * The response will provide the classification results for the video in JSON format. For video classification, the video is divided into *frames*.<br> In the response, you will find a ***results*** array that includes the classification outcomes for each model applied to each analyzed frame, and a ***verdicts*** array containing the results for each heuristic used.<br> If the classification is not complete, continue sending the **GET** request until the final results are returned.</details><details><summary>**3. All Classifications**</summary>The `/api/classifications` endpoint will return all the image classifications made by a user. This will list the results of all past image classification requests.</details><details><summary>**4. User Management**</summary>  The **POST** `/api/user` endpoint allows you to create a user, while the **DELETE** `/api/user` endpoint is used to delete a user (For the structure of the requests, see more in the user section below).</details></details>
servers:
  - url: https://backend.identifai.net
security: []
tags:
  - name: Classification
    description: Classification routes
  - name: Infrastructure
    description: Infrastructure routes
  - name: User
    description: User actions
  - name: Partner
    description: Partner actions
paths:
  /api/classification:
    post:
      tags:
        - Classification
      summary: Classify an image
      description: >-
        Submit an image to be classified as human or artificial.


        🔁 Response format varies based on the `Accept` header:


        `Accept: application/json` → `{ "identifier": "..." }`

         Other values (e.g. `text/plain`) → plain text with just the identifier string.

        **Note:** This endpoint also has an alias available at
        `/api/classification_image`.
      parameters:
        - name: Accept
          in: header
          description: 'Response content type. Supported: application/json, text/plain.'
          required: false
          schema:
            type: string
            enum:
              - application/json
              - text/plain
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                image:
                  type: string
                  format: binary
                  description: >-
                    The image to be classified. **Supported formats:** PNG,
                    JPEG, JPG, WebP, TIF, TIFF. **MIME types:** image/png,
                    image/jpeg, image/jpg, image/webp, image/tif, image/tiff.
                    **Maximum file size:** 15MB.
                ref_id:
                  type: string
                  description: >-
                    An optional reference ID to associate with the
                    classification request.
                with_morphing:
                  type: boolean
                  description: >-
                    Set it to true if you also want to analyze people's faces in
                    the image using morphing.
                with_tampering:
                  type: boolean
                  description: >-
                    Set it to true if you also want to analyze signs of
                    tampering or manipulation without the aid of a Generative AI
                with_heatmap:
                  type: boolean
                  description: >-
                    Set it to true if you also want to get an AI content
                    heatmap.
                with_smart_analysis:
                  type: boolean
                  description: >-
                    Set it to true to enable the **Smart Full Analysis**: a
                    proprietary scoring algorithm selects the most informative
                    areas of the image, which are classified as separate crops
                    by the most advanced model of the Revelio family and then
                    combined into an overall verdict. Being an advanced, smart
                    version of both, **it replaces the standard full analysis
                    and the heatmap analysis**: it cannot be combined with
                    `with_heatmap`, sending both set to true returns a `422`
                    error. **You must be enabled in your pricing plan to use
                    it**, otherwise the parameter is ignored. See [Smart Full
                    Analysis](/classification/classify-image#smart-full-analysis)
                    for details.
                webhook_url:
                  type: string
                  description: >-
                    If specified, the classification result will also be
                    automatically sent to the entered URL. Otherwise, the result
                    can be obtained by polling the [relative
                    endpoint](./get-classification-result). Please note that in
                    order to use a webhook callback URL **you need to request a
                    specific enablement**, otherwise the parameter is ignored.
                    Moreover, the system may cache the analysis results of
                    repeated submissions, i.e. submissions of the same file with
                    the same options: in this case the webhook won't be called
                    and the results would be accessible only by polling the
                    [relative endpoint](./get-classification-result).
                with_xai:
                  type: boolean
                  description: >-
                    Set it to true to enable the **XAI – eXplainable AI** scope:
                    besides the verdict, the Revelio models return information
                    on the areas of the image they focused on during the
                    classification (attention map and attention graph). **You
                    must be enabled in your pricing plan to use it**, otherwise
                    the parameter is ignored. See [XAI – eXplainable
                    AI](/classification/classify-image#xai-explainable-ai) for
                    details. **Data Transfer Notice:** Enabling this feature
                    transfers your image data to our EU cloud infrastructure for
                    model inference.
                with_llm_xai:
                  type: boolean
                  description: >-
                    Set it to true, together with `with_xai`, to also get the
                    **AI-powered explanations**: a natural-language description
                    of the regions that received the most attention, returned in
                    the `description` of the `explanations` of the per-model
                    results once the [deferred
                    results](/api-reference/deferred-results) are ready. It is
                    ignored when `with_xai` is not enabled. If XAI is included
                    in your pricing plan but the AI-powered explanations are
                    not, a request with `with_llm_xai=true` is rejected with a
                    `403` error. The credits of the explanations that cannot be
                    generated are refunded. The AI-powered explanations are
                    generated with models that are not developed by identifAI.
                llm_xai_language:
                  type: string
                  enum:
                    - english
                    - italian
                    - spanish
                    - german
                  description: >-
                    Language of the AI-powered explanations (case-insensitive).
                    If omitted, the default language of your pricing plan is
                    used. It is applied only together with `with_llm_xai`; an
                    unsupported value is rejected with a `400` error.
                deferred_webhook_url:
                  type: string
                  description: >-
                    If specified, the URL is notified once when the **deferred
                    results** of the submission are complete (e.g. the textual
                    explanations of the XAI maps and of the heatmap), after the
                    main results sent to `webhook_url`. The notification carries
                    the event `submission.deferred.completed`: see [Deferred
                    results](/api-reference/deferred-results) for the payload.
                    The same enablement, domain restrictions and authentication
                    of `webhook_url` apply. Delivery is *at least once*:
                    deduplicate by `identifier`, and note that an `expired`
                    notification can be followed by a second one with the real
                    outcome, which supersedes it. If omitted or empty, no
                    deferred notification is sent.
                no_cache:
                  type: boolean
                  description: >-
                    Set it to true to force the system to reprocess the image
                    even if it has been previously submitted with the same
                    options. This may result in additional charges.
                prevent_c2pa_forces:
                  type: boolean
                  description: >-
                    If true, C2PA signature does not force the origin to
                    artificial. If false or undefined, C2PA signature will force
                    the origin to artificial (current behaviour).
                with_nsfw:
                  type: boolean
                  description: >-
                    Set it to true if you also want to enable NSFW (Not Safe For
                    Work) content detection.
              required:
                - image
            encoding:
              image:
                contentType: image/png, image/jpeg, image/jpg, image/webp, image/tiff
      responses:
        '200':
          description: >-
            The classification identifier. The format depends on the Accept
            header.
          content:
            application/json:
              schema:
                type: object
                properties:
                  identifier:
                    type: string
                    example: >-
                      8d64370a87b820cc1cf620338f5c898bab37439c9a405f32d9eaffc50c4f27b0
              example:
                identifier: >-
                  8d64370a87b820cc1cf620338f5c898bab37439c9a405f32d9eaffc50c4f27b0
            text/plain:
              schema:
                type: string
                example: >-
                  8d64370a87b820cc1cf620338f5c898bab37439c9a405f32d9eaffc50c4f27b0
              example: 8d64370a87b820cc1cf620338f5c898bab37439c9a405f32d9eaffc50c4f27b0
        '400':
          description: >-
            The user has no enough credits to perform the operation, the request
            contains the wrong parameters or the media did not pass validation
            steps.
          content:
            application/json:
              examples:
                invalid_llm_xai_language:
                  summary: Unsupported language of the AI-powered explanations
                  value:
                    error:
                      llm_xai_language:
                        - The selected llm xai language is invalid.
                missing_image:
                  value:
                    error:
                      image:
                        - The image field is required
                invalid_image_format:
                  value:
                    error:
                      image:
                        - >-
                          The image must be a file of type: png, jpeg, jpg,
                          webp, tiff.
                image_too_large:
                  value:
                    error:
                      image:
                        - The image may not be greater than 50Mb.
        '401':
          description: Invalid or missing API key.
          content:
            application/json:
              example:
                error: Unauthorized
        '403':
          description: >-
            The user is not authorized to access this API or did not accept the
            terms of service, or `with_llm_xai` was set to true but the
            AI-powered explanations of XAI are not included in your pricing
            plan.
          content:
            application/json:
              examples:
                forbidden:
                  summary: Forbidden
                  value:
                    error: Forbidden
                llm_xai_not_enabled:
                  summary: AI-powered explanations not enabled
                  value:
                    error: >-
                      LLM explanations (with_llm_xai) are not enabled for your
                      plan
        '422':
          description: >-
            The request contains incompatible options: `with_smart_analysis` and
            `with_heatmap` cannot be both set to true, since Smart Full Analysis
            already replaces the heatmap analysis.
        '429':
          description: Too many requests.
          content:
            application/json:
              example:
                error: Too Many Attempts.
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      name: X-Api-Key
      in: header
      description: Your API key.

````

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