{
  "opencollection": "1.0.0",
  "info": {
    "name": "Kili Technology GraphQL API",
    "version": "2.0",
    "description": "Single GraphQL endpoint for the Kili Technology data-labeling platform: projects, assets, labels, issues, and users."
  },
  "request": {
    "auth": {
      "type": "apikey",
      "key": "Authorization",
      "value": "X-API-Key: {{kiliApiKey}}",
      "in": "header"
    }
  },
  "items": [
    {
      "info": { "name": "Projects", "type": "folder" },
      "items": [
        {
          "info": { "name": "List Projects", "type": "http" },
          "http": {
            "method": "POST",
            "url": "https://cloud.kili-technology.com/api/label/v2/graphql",
            "headers": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "Accept", "value": "application/json" }
            ],
            "body": {
              "type": "json",
              "data": "{\"query\":\"query projects($where: ProjectWhere!, $first: PageSize!, $skip: Int!) { data: projects(where: $where, first: $first, skip: $skip) { id title numberOfAssets } }\",\"variables\":{\"where\":{\"id\":\"{{projectId}}\"},\"first\":10,\"skip\":0}}"
            }
          },
          "docs": "List annotation projects. GraphQL query: projects."
        },
        {
          "info": { "name": "Create Project", "type": "http" },
          "http": {
            "method": "POST",
            "url": "https://cloud.kili-technology.com/api/label/v2/graphql",
            "headers": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "Accept", "value": "application/json" }
            ],
            "body": {
              "type": "json",
              "data": "{\"query\":\"mutation($data: CreateProjectData!) { data: createProject(data: $data) { id } }\",\"variables\":{\"data\":{\"title\":\"My labeling project\",\"inputType\":\"IMAGE\",\"jsonInterface\":\"{\\\"jobs\\\": {}}\"}}}"
            }
          },
          "docs": "Create a new annotation project. GraphQL mutation: createProject."
        }
      ]
    },
    {
      "info": { "name": "Assets", "type": "folder" },
      "items": [
        {
          "info": { "name": "Count Assets", "type": "http" },
          "http": {
            "method": "POST",
            "url": "https://cloud.kili-technology.com/api/label/v2/graphql",
            "headers": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "Accept", "value": "application/json" }
            ],
            "body": {
              "type": "json",
              "data": "{\"query\":\"query countAssets($where: AssetWhere!) { data: countAssets(where: $where) }\",\"variables\":{\"where\":{\"project\":{\"id\":\"{{projectId}}\"}}}}"
            }
          },
          "docs": "Count assets in a project. GraphQL query: countAssets."
        },
        {
          "info": { "name": "Append Many Assets", "type": "http" },
          "http": {
            "method": "POST",
            "url": "https://cloud.kili-technology.com/api/label/v2/graphql",
            "headers": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "Accept", "value": "application/json" }
            ],
            "body": {
              "type": "json",
              "data": "{\"query\":\"mutation appendManyAssets($data: AppendManyAssetsData!, $where: ProjectWhere!) { data: appendManyAssets(data: $data, where: $where) { id } }\",\"variables\":{\"data\":{\"contentArray\":[\"https://example.com/image.jpg\"],\"externalIdArray\":[\"image-1\"]},\"where\":{\"id\":\"{{projectId}}\"}}}"
            }
          },
          "docs": "Import assets into a project. GraphQL mutation: appendManyAssets."
        }
      ]
    },
    {
      "info": { "name": "Labels", "type": "folder" },
      "items": [
        {
          "info": { "name": "List Labels", "type": "http" },
          "http": {
            "method": "POST",
            "url": "https://cloud.kili-technology.com/api/label/v2/graphql",
            "headers": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "Accept", "value": "application/json" }
            ],
            "body": {
              "type": "json",
              "data": "{\"query\":\"query labels($where: LabelWhere!, $first: PageSize!, $skip: Int!) { data: labels(where: $where, first: $first, skip: $skip) { id labelType jsonResponse createdAt author { email } labelOf { id } } }\",\"variables\":{\"where\":{\"project\":{\"id\":\"{{projectId}}\"}},\"first\":100,\"skip\":0}}"
            }
          },
          "docs": "List labels for a project. GraphQL query: labels."
        },
        {
          "info": { "name": "Append Many Labels", "type": "http" },
          "http": {
            "method": "POST",
            "url": "https://cloud.kili-technology.com/api/label/v2/graphql",
            "headers": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "Accept", "value": "application/json" }
            ],
            "body": {
              "type": "json",
              "data": "{\"query\":\"mutation appendManyLabels($data: AppendManyLabelsData!, $where: AssetWhere!) { data: appendManyLabels(data: $data, where: $where) { id } }\",\"variables\":{\"data\":{\"labelType\":\"DEFAULT\",\"jsonResponseArray\":[\"{}\"]},\"where\":{\"id\":\"{{assetId}}\"}}}"
            }
          },
          "docs": "Add labels to an asset. GraphQL mutation: appendManyLabels."
        }
      ]
    },
    {
      "info": { "name": "Issues", "type": "folder" },
      "items": [
        {
          "info": { "name": "Count Issues", "type": "http" },
          "http": {
            "method": "POST",
            "url": "https://cloud.kili-technology.com/api/label/v2/graphql",
            "headers": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "Accept", "value": "application/json" }
            ],
            "body": {
              "type": "json",
              "data": "{\"query\":\"query countIssues($where: IssueWhere!) { data: countIssues(where: $where) }\",\"variables\":{\"where\":{\"project\":{\"id\":\"{{projectId}}\"}}}}"
            }
          },
          "docs": "Count review issues in a project. GraphQL query: countIssues."
        },
        {
          "info": { "name": "Create Issues", "type": "http" },
          "http": {
            "method": "POST",
            "url": "https://cloud.kili-technology.com/api/label/v2/graphql",
            "headers": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "Accept", "value": "application/json" }
            ],
            "body": {
              "type": "json",
              "data": "{\"query\":\"mutation createIssues($issues: [IssueToCreate!]!, $where: AssetWhere!) { data: createIssues(issues: $issues, where: $where) { id } }\",\"variables\":{\"issues\":[{\"text\":\"Please review this annotation\",\"type\":\"QUESTION\"}],\"where\":{\"id\":\"{{assetId}}\"}}}"
            }
          },
          "docs": "Create review issues or questions on an asset. GraphQL mutation: createIssues."
        }
      ]
    },
    {
      "info": { "name": "Users", "type": "folder" },
      "items": [
        {
          "info": { "name": "Current User (viewer)", "type": "http" },
          "http": {
            "method": "POST",
            "url": "https://cloud.kili-technology.com/api/label/v2/graphql",
            "headers": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "Accept", "value": "application/json" }
            ],
            "body": {
              "type": "json",
              "data": "{\"query\":\"query me { data: viewer { id email firstname lastname } }\"}"
            }
          },
          "docs": "Fetch the current authenticated user. GraphQL query: viewer."
        },
        {
          "info": { "name": "List Users", "type": "http" },
          "http": {
            "method": "POST",
            "url": "https://cloud.kili-technology.com/api/label/v2/graphql",
            "headers": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "Accept", "value": "application/json" }
            ],
            "body": {
              "type": "json",
              "data": "{\"query\":\"query users($where: UserWhere!, $first: PageSize!, $skip: Int!) { data: users(where: $where, first: $first, skip: $skip) { id email firstname lastname } }\",\"variables\":{\"where\":{},\"first\":10,\"skip\":0}}"
            }
          },
          "docs": "List organization users. GraphQL query: users."
        }
      ]
    }
  ]
}
