---
swagger: "2.0"
info:
  description: "This is the Curio Genomics web services API."
  version: "1.0.0"
  title: "Curio Genomics Services API"
  contact:
    email: "support@curiogenomics.com"
  license:
    name: "Apache 2.0"
    url: "http://www.apache.org/licenses/LICENSE-2.0.html"
host: "api.curiogenomics.com"
basePath: "/v1"
schemes:
  - "https"
  - "http"
paths:
  /projects:
    post:
      tags:
        - "projects"
      summary: "Create a project"
      description: "Create a new project within a given organization"
      operationId: "createProject"
      consumes:
        - "application/json"
      produces:
        - "application/json"
      parameters:
        - in: "body"
          name: "createProjectRequest"
          description: "The set of properties to be associated with the new project"
          required: true
          schema:
            $ref: "#/definitions/CreateProjectRequest"
      responses:
        200:
          description: "Successful operation"
          schema:
            $ref: "#/definitions/Project"
        400:
          description: "Missing required fields"
        401:
          description: "Invalid API key supplied"
        404:
          description: "Organization not found"
      security:
        - API-Key: []
  /projects/{projectId}:
    get:
      tags:
        - "projects"
      summary: "Find details on a project"
      description: "Returns the details on single project's record"
      operationId: "getProject"
      produces:
        - "application/json"
      parameters:
        - in: "path"
          name: "projectId"
          description: "The unique identifier of the project to retrieve"
          required: true
          type: "string"
      responses:
        200:
          description: "Successful operation"
          schema:
            $ref: "#/definitions/Project"
        400:
          description: "Missing required fields"
        401:
          description: "Invalid API key supplied"
        404:
          description: "Project not found"
      security:
        - API-Key: []
  /projects/{projectId}/items:
    get:
      tags:
        - "projects"
      summary: "Retrieve all items in project"
      description: "Returns the details on all items within a project"
      operationId: "getProjectItems"
      produces:
        - "application/json"
      parameters:
        - in: "path"
          name: "projectId"
          description: "The unique identifier of the project to retrieve items from"
          required: true
          type: "string"
      responses:
        200:
          description: "Successful operation"
          schema:
            type: array
            items:
              $ref: '#/definitions/ProjectItem'
        400:
          description: "Missing required fields"
        401:
          description: "Invalid API key supplied"
        404:
          description: "Project not found"
      security:
        - API-Key: []
  /projects/{projectId}/itemsOfType/{itemType}:
    get:
      tags:
        - "projects"
      summary: "Retrieve items of type in project"
      description: "Returns the details on all items within a project of a given type"
      operationId: "getProjectItemsOfType"
      produces:
        - "application/json"
      parameters:
        - in: "path"
          name: "projectId"
          description: "The unique identifier of the project to retrieve items from"
          required: true
          type: "string"
        - in: "path"
          name: "itemType"
          description: "The type of item to retrieve"
          required: true
          type: "string"
          enum:
            - "FASTA"
            - "FASTQ"
            - "SRA"
            - "SEQUENCE_ALIGNMENT"
            - "CHROMOSOME_BANDS"
            - "GENOME_FEATURES"
            - "VARIANT_CALLS"
            - "VARIANT_ASSEMBLY"
            - "COVERAGE_ANALYSIS"
            - "EXPRESSION_ANALYSIS"
            - "FASTQ_QUALITY"
      responses:
        200:
          description: "Successful operation"
          schema:
            type: array
            items:
              $ref: '#/definitions/ProjectItem'
        400:
          description: "Missing required fields"
        401:
          description: "Invalid API key supplied"
        404:
          description: "Project not found"
      security:
        - API-Key: []
  /projects/{projectId}/importFromUrl:
    post:
      tags:
        - "projects"
      summary: "Import a file into project from a URL"
      description: "Start an import of a file into a project from an HTTP/HTTPS end point"
      operationId: "importFromUrl"
      consumes:
        - "application/json"
      produces:
        - "application/json"
      parameters:
        - in: "path"
          name: "projectId"
          description: "The unique identifier of the project to import data into"
          required: true
          type: "string"
        - in: "body"
          name: "importFromUrlRequest"
          description: "The set of properties that defines the file to import"
          required: true
          schema:
            $ref: "#/definitions/ImportFromUrlRequest"
      responses:
        200:
          description: "Successful operation"
          schema:
            $ref: "#/definitions/ProjectItem"
        400:
          description: "Missing required fields"
        401:
          description: "Invalid API key supplied"
        404:
          description: "Project not found"
      security:
        - API-Key: []
  /projects/{projectId}/startAnalysis:
    post:
      tags:
        - "projects"
      summary: "Start a single project analysis"
      description: "Start a single analysis within a project"
      operationId: "startAnalysis"
      consumes:
        - "application/json"
      produces:
        - "application/json"
      parameters:
        - in: "path"
          name: "projectId"
          description: "The unique identifier of the project to start the analysis within"
          required: true
          type: "string"
        - in: "body"
          name: "startAnalysisRequest"
          description: "The set of properties that defines the analysis to start"
          required: true
          schema:
            $ref: "#/definitions/StartAnalysisRequest"
      responses:
        200:
          description: "Successful operation"
          schema:
            $ref: "#/definitions/StartAnalysisResponse"
        400:
          description: "Missing required fields"
        401:
          description: "Invalid API key supplied"
        404:
          description: "Project not found"
      security:
        - API-Key: []
  /projects/{projectId}/startAnalyses:
    post:
      tags:
        - "projects"
      summary: "Start multiple project analyses"
      description: "Start multiple analyses within a project"
      operationId: "startAnalyses"
      consumes:
        - "application/json"
      produces:
        - "application/json"
      parameters:
        - in: "path"
          name: "projectId"
          description: "The unique identifier of the project to start the analyses within"
          required: true
          type: "string"
        - in: "body"
          name: "startAnalysesRequest"
          description: "The set of properties that defines all of the analyses to start"
          required: true
          schema:
            $ref: "#/definitions/StartAnalysesRequest"
      responses:
        200:
          description: "Successful operation"
          schema:
            $ref: "#/definitions/StartAnalysesResponse"
        400:
          description: "Missing required fields"
        401:
          description: "Invalid API key supplied"
        404:
          description: "Project not found"
      security:
        - API-Key: []
securityDefinitions:
  API-Key:
    type: "apiKey"
    name: "API-Key"
    in: "header"
definitions:
  Project:
    type: "object"
    required:
      - "projectId"
      - "name"
    properties:
      projectId:
        type: "string"
        example: "HeMvMh1GP1MM6Rtab1sc"
        description:
          The unique id of the project.
      name:
        type: "string"
        example: "My Fabulous Project"
        description:
          The name that has been configured for the project within the console.
      description:
        type: "string"
        example: "Much ado about a fabulous project."
        description:
          The long description that has been configured for the project within the console.
    xml:
      name: "Project"
  ProjectItem:
    type: "object"
    required:
      - "projectItemKey"
      - "name"
    properties:
      projectItemKey:
        type: "string"
        example: "elHeRaAtf7OVvhlPsZGZ"
        description:
          The unique key of the project item (which includes both the project id and item id).
      name:
        type: "string"
        example: "SampleA_R1.fastq"
        description:
          The name that is associated with the project item.
      sizeInBytes:
        type: integer
        format: int64
        description:
          The total size of the storage used by the item (in bytes).
      recordCount:
        type: integer
        format: int64
        description:
          If applicable to the item type and item state, the number of total records contained within the item.
      itemState:
        $ref: "#/components/ProjectItem.State"
      itemType:
        $ref: "#/components/ProjectItem.Type"
    xml:
      name: "ProjectItem"
  ProjectItem.Type:
    type: string
    example: "FASTQ"
    description:
      The type of item, as assigned by the Curio system.
    enum:
      - "FASTA"
      - "FASTQ"
      - "SRA"
      - "SEQUENCE_ALIGNMENT"
      - "CHROMOSOME_BANDS"
      - "GENOME_FEATURES"
      - "VARIANT_CALLS"
      - "VARIANT_ASSEMBLY"
      - "COVERAGE_ANALYSIS"
      - "EXPRESSION_ANALYSIS"
      - "FASTQ_QUALITY"
      - "UNKNOWN"
  ProjectItem.State:
    type: string
    example: "PROCESSED"
    description:
      The state of the item, as assigned by the Curio system.
    enum:
      - "UPLOADING"
      - "IMPORTING"
      - "CREATED"
      - "IDENTIFYING"
      - "IDENTIFIED"
      - "INITIALIZED"
      - "PROCESSING"
      - "PROCESSED"
      - "ERROR"
      - "INDEXING"
      - "INDEXED"
      - "DELETING"
      - "DELETED"
      - "UNKNOWN"
  CreateProjectRequest:
    type: object
    required:
      - organizationId
      - name
    properties:
      organizationId:
        description:
          The unique id of the organization in which the project should be created
        type: "string"
      name:
        description:
          The display name to associate with the new project
        type: "string"
      description:
        description:
          An optional more details description to associate with the new project
        type: "string"
  ImportFromUrlRequest:
    type: object
    required:
      - url
    properties:
      url:
        description:
          The fully qualified URL (including the 'http://' or 'https://' prefix) that you would like to be
          fetched and imported into the project.
        type: "string"
      name:
        description:
          By default Curio will automatically determine a name and file type extension to use for the newly
          imported file based on the information provided by the remote web server. However, if you'd like to
          override the name that Curio will use for the imported file within the project simply specify the
          desired name on this property.
        type: "string"
  StartAnalysisRequest:
    type: object
    required:
      - jobTemplateProjectItemKey
      - inputProjectItemKeyA
    properties:
      jobTemplateProjectItemKey:
        description:
          The unique key of the job template that defines the details of the analysis to be performed
        type: "string"
        example: "wqzJ77i2MHnzlJAyFxy4/byKJdkkQk0tdSmc1vO10"
      inputProjectItemKeyA:
        description:
          The unique key of the first item that should serve as the input to the analysis.
        type: "string"
        example: "wqzJ77i2MHnzlJAyFxy4/byKJdkkQk0tdSmc1vO10"
      inputProjectItemKeyB:
        description:
          The unique key of the second item that should serve as the input to the analysis
          (i.e. for an analysis that requires paired-end FASTQ data for its input, the
          'inputProjectItemKeyA' property would be used to specify the "R1" FASTQ file and
          'inputProjectItemKeyB' property would be used to specify the "R2" FASTQ file.)
        type: "string"
        example: "wqzJ77i2MHnzlJAyFxy4/byKJdkkQk0tdSmc1vO10"
      sendEmailWhenComplete:
        description:
          If enabled, an email will be sent to the user account associated with the request
          after the analysis has completed.  Note that, in the case that a job template
          includes multiple analysis jobs an email will be sent when each individual
          job is completed.  Defaults to 'false'.
        type: "boolean"
        example: false
  StartAnalysisResponse:
    type: "object"
    required:
      - "jobsStartedCount"
    properties:
      jobsStartedCount:
        type: "integer"
        format: "int32"
        description:
          The number of individual jobs that were started as a result of starting the requested job template.
        example: 3
  StartAnalysesRequest:
    type: object
    required:
      - jobTemplateProjectItemKey
      - analyisInputs
    properties:
      jobTemplateProjectItemKey:
        description:
          The unique key of the job template that defines the details of the analyses to be performed on each input
        type: "string"
        example: "wqzJ77i2MHnzlJAyFxy4/byKJdkkQk0tdSmc1vO10"
      analyisInputs:
        type: array
        items:
          $ref: '#/definitions/AnalysisInput'
      sendEmailWhenComplete:
        description:
          If enabled, an email will be sent to the user account associated with the request
          after the analysis has completed.  Note that, in the case that a job template
          includes multiple analysis jobs an email will be sent when each individual
          job is completed.  Defaults to 'false'.
        type: "boolean"
        example: false
  StartAnalysesResponse:
    type: "object"
    required:
      - "jobsStartedCount"
    properties:
      jobsStartedCount:
        type: "integer"
        format: "int32"
        description:
          The number of individual jobs that were started as a result of starting the requested job templates.
        example: 6
  AnalysisInput:
    type: "object"
    required:
      - "jobTemplateProjectItemKey"
      - "inputProjectItemKeyA"
    properties:
      inputProjectItemKeyA:
        description:
          The unique key of the first item that should serve as the input to the analysis.
        type: "string"
        example: "wqzJ77i2MHnzlJAyFxy4/byKJdkkQk0tdSmc1vO10"
      inputProjectItemKeyB:
        description:
          The unique key of the second item that should serve as the input to the analysis
          (i.e. for an analysis that requires paired-end FASTQ data for its input, the
          'inputProjectItemKeyA' property would be used to specify the "R1" FASTQ file and
          'inputProjectItemKeyB' property would be used to specify the "R2" FASTQ file.)
        type: "string"
        example: "wqzJ77i2MHnzlJAyFxy4/byKJdkkQk0tdSmc1vO10"
externalDocs:
  description: "Find out more about Curio Genomics"
  url: "https://www.curiogenomics.com/"
