openapi: 3.0.0
servers:
  - url: https://southcentralus.api.cognitive.microsoft.com/customvision/v1.1/Prediction
info:
  contact:
    x-twitter: microsoft
  title: PredictionEndpoint
  version: "1.1"
  x-apisguru-categories:
    - developer_tools
    - cloud
  x-logo:
    url: https://api.apis.guru/v2/cache/logo/https_twitter.com_microsoft_profile_image.png
  x-origin:
    - format: openapi
      url: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/cognitiveservices/data-plane/CustomVision/Prediction/stable/v1.1/Prediction.json
      version: "3.0"
  x-preferred: false
  x-providerName: microsoft.com
  x-serviceName: cognitiveservices-Prediction
  x-tags:
    - Microsoft
paths:
  "/{projectId}/image":
    post:
      operationId: PredictImage
      parameters:
        - description: The project id
          examples:
            Successful Prediction with Image request:
              value: 64b822c5-8082-4b36-a426-27225f4aa18c
          in: path
          name: projectId
          required: true
          schema:
            format: uuid
            type: string
          x-nullable: false
        - description: "Optional. Specifies the id of a particular iteration to evaluate against.\r

            \            The default iteration for the project will be used when not specified"
          examples:
            Successful Prediction with Image request:
              value: fe1e83c4-6f50-4899-9544-6bb08cf0e15a
          in: query
          name: iterationId
          required: false
          schema:
            format: uuid
            type: string
          x-nullable: true
        - description: Optional. Specifies the name of application using the endpoint
          in: query
          name: application
          required: false
          schema:
            type: string
          x-nullable: true
        - $ref: "#/components/parameters/ApiKey"
      requestBody:
        $ref: "#/components/requestBodies/PredictImage"
      responses:
        "200":
          content:
            application/json:
              examples:
                Successful Prediction with Image request:
                  $ref: "#/components/examples/Successful_Prediction_with_Image_request"
              schema:
                $ref: "#/components/schemas/ImagePredictionResultModel"
            application/xml:
              examples:
                Successful Prediction with Image request:
                  $ref: "#/components/examples/Successful_Prediction_with_Image_request"
              schema:
                $ref: "#/components/schemas/ImagePredictionResultModel"
            text/json:
              examples:
                Successful Prediction with Image request:
                  $ref: "#/components/examples/Successful_Prediction_with_Image_request"
              schema:
                $ref: "#/components/schemas/ImagePredictionResultModel"
            text/xml:
              examples:
                Successful Prediction with Image request:
                  $ref: "#/components/examples/Successful_Prediction_with_Image_request"
              schema:
                $ref: "#/components/schemas/ImagePredictionResultModel"
          description: OK
      summary: Predict an image and saves the result
      tags:
        - ImagePredictionApi
  "/{projectId}/image/nostore":
    post:
      operationId: PredictImageWithNoStore
      parameters:
        - description: The project id
          in: path
          name: projectId
          required: true
          schema:
            format: uuid
            type: string
          x-nullable: false
        - description: "Optional. Specifies the id of a particular iteration to evaluate against.\r

            \            The default iteration for the project will be used when not specified"
          in: query
          name: iterationId
          required: false
          schema:
            format: uuid
            type: string
          x-nullable: true
        - description: Optional. Specifies the name of application using the endpoint
          in: query
          name: application
          required: false
          schema:
            type: string
          x-nullable: true
        - $ref: "#/components/parameters/ApiKey"
      requestBody:
        $ref: "#/components/requestBodies/PredictImage"
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ImagePredictionResultModel"
            application/xml:
              schema:
                $ref: "#/components/schemas/ImagePredictionResultModel"
            text/json:
              schema:
                $ref: "#/components/schemas/ImagePredictionResultModel"
            text/xml:
              schema:
                $ref: "#/components/schemas/ImagePredictionResultModel"
          description: OK
      summary: Predict an image without saving the result
      tags:
        - ImagePredictionApi
  "/{projectId}/url":
    post:
      operationId: PredictImageUrl
      parameters:
        - description: The project id
          examples:
            Successful Prediction with Url request:
              value: 64b822c5-8082-4b36-a426-27225f4aa18c
          in: path
          name: projectId
          required: true
          schema:
            format: uuid
            type: string
          x-nullable: false
        - description: "Optional. Specifies the id of a particular iteration to evaluate against.\r

            \            The default iteration for the project will be used when not specified"
          examples:
            Successful Prediction with Url request:
              value: fe1e83c4-6f50-4899-9544-6bb08cf0e15a
          in: query
          name: iterationId
          required: false
          schema:
            format: uuid
            type: string
          x-nullable: true
        - description: Optional. Specifies the name of application using the endpoint
          in: query
          name: application
          required: false
          schema:
            type: string
          x-nullable: true
        - $ref: "#/components/parameters/ApiKey"
      requestBody:
        $ref: "#/components/requestBodies/ImageUrl"
      responses:
        "200":
          content:
            application/json:
              examples:
                Successful Prediction with Url request:
                  $ref: "#/components/examples/Successful_Prediction_with_Url_request"
              schema:
                $ref: "#/components/schemas/ImagePredictionResultModel"
            application/xml:
              examples:
                Successful Prediction with Url request:
                  $ref: "#/components/examples/Successful_Prediction_with_Url_request"
              schema:
                $ref: "#/components/schemas/ImagePredictionResultModel"
            text/json:
              examples:
                Successful Prediction with Url request:
                  $ref: "#/components/examples/Successful_Prediction_with_Url_request"
              schema:
                $ref: "#/components/schemas/ImagePredictionResultModel"
            text/xml:
              examples:
                Successful Prediction with Url request:
                  $ref: "#/components/examples/Successful_Prediction_with_Url_request"
              schema:
                $ref: "#/components/schemas/ImagePredictionResultModel"
          description: OK
      summary: Predict an image url and saves the result
      tags:
        - ImagePredictionApi
  "/{projectId}/url/nostore":
    post:
      operationId: PredictImageUrlWithNoStore
      parameters:
        - description: The project id
          in: path
          name: projectId
          required: true
          schema:
            format: uuid
            type: string
          x-nullable: false
        - description: "Optional. Specifies the id of a particular iteration to evaluate against.\r

            \            The default iteration for the project will be used when not specified"
          in: query
          name: iterationId
          required: false
          schema:
            format: uuid
            type: string
          x-nullable: true
        - description: Optional. Specifies the name of application using the endpoint
          in: query
          name: application
          required: false
          schema:
            type: string
          x-nullable: true
        - $ref: "#/components/parameters/ApiKey"
      requestBody:
        $ref: "#/components/requestBodies/ImageUrl"
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ImagePredictionResultModel"
            application/xml:
              schema:
                $ref: "#/components/schemas/ImagePredictionResultModel"
            text/json:
              schema:
                $ref: "#/components/schemas/ImagePredictionResultModel"
            text/xml:
              schema:
                $ref: "#/components/schemas/ImagePredictionResultModel"
          description: OK
      summary: Predict an image url without saving the result
      tags:
        - ImagePredictionApi
components:
  examples:
    Successful_Prediction_with_Image_request:
      value:
        Created: 2017-12-19T14:21:41.6789561Z
        Id: 951098b2-9b69-427b-bddb-d5cb618874e3
        Iteration: fe1e83c4-6f50-4899-9544-6bb08cf0e15a
        Predictions:
          - Probability: 0.05149666
            Tag: Hemlock
            TagId: e31ff107-5505-4753-be42-b369b21b026c
          - Probability: 0
            Tag: Japanese Cherry
            TagId: 349d72ac-0948-4d51-b1e4-c14a1f9b848a
        Project: 64b822c5-8082-4b36-a426-27225f4aa18c
    Successful_Prediction_with_Url_request:
      value:
        Created: 2017-12-19T14:21:41.6789561Z
        Id: 951098b2-9b69-427b-bddb-d5cb618874e3
        Iteration: fe1e83c4-6f50-4899-9544-6bb08cf0e15a
        Predictions:
          - Probability: 0.05149666
            Tag: Hemlock
            TagId: e31ff107-5505-4753-be42-b369b21b026c
          - Probability: 0.000193528482
            Tag: Japanese Cherry
            TagId: 349d72ac-0948-4d51-b1e4-c14a1f9b848a
        Project: 64b822c5-8082-4b36-a426-27225f4aa18c
  parameters:
    ApiKey:
      examples:
        Successful Prediction with Image request:
          value: "{API Key}"
        Successful Prediction with Url request:
          value: "{API Key}"
      in: header
      name: Prediction-Key
      required: true
      schema:
        type: string
      x-ms-client-name: ApiKey
      x-ms-parameter-location: client
  requestBodies:
    ImageUrl:
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ImageUrl"
        application/x-www-form-urlencoded:
          schema:
            $ref: "#/components/schemas/ImageUrl"
        application/xml:
          schema:
            $ref: "#/components/schemas/ImageUrl"
        text/json:
          schema:
            $ref: "#/components/schemas/ImageUrl"
        text/xml:
          schema:
            $ref: "#/components/schemas/ImageUrl"
      description: An {Iris.Web.Api.Models.ImageUrl} that contains the url of the image to be evaluated
      required: true
    PredictImage:
      content:
        multipart/form-data:
          schema:
            properties:
              imageData:
                format: binary
                type: string
            required:
              - imageData
            type: object
      required: true
  schemas:
    ImagePredictionResultModel:
      description: result of an image prediction request
      nullable: true
      properties:
        Created:
          format: date-time
          nullable: false
          readOnly: true
          type: string
        Id:
          format: uuid
          nullable: false
          readOnly: true
          type: string
        Iteration:
          format: uuid
          nullable: false
          readOnly: true
          type: string
        Predictions:
          items:
            $ref: "#/components/schemas/ImageTagPredictionModel"
          nullable: true
          readOnly: true
          type: array
        Project:
          format: uuid
          nullable: false
          readOnly: true
          type: string
      type: object
    ImageTagPredictionModel:
      nullable: true
      properties:
        Probability:
          format: float
          nullable: false
          readOnly: true
          type: number
        Tag:
          nullable: true
          readOnly: true
          type: string
        TagId:
          format: uuid
          nullable: false
          readOnly: true
          type: string
      type: object
    ImageUrl:
      nullable: true
      properties:
        Url:
          nullable: true
          type: string
      type: object
