> For the complete documentation index, see [llms.txt](https://docs.colormass.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.colormass.com/dev/data-exporter/api-access.md).

# API Access

The colormass API is available at <https://gql.colormass.com/graphql>

## Authentication

In the Headers tab, enter the demo API key to authenticate to the backend:

{% code lineNumbers="true" %}

```json
{
 "X-Api-Key": "0ecff5f6-5b65-42bf-84d1-facf9ed37c7avf"
}
```

{% endcode %}

The following query will return download URLs for thumbnails/tileable images:

{% code lineNumbers="true" %}

```graphql
query GetMaterialDownloadLink($articleId: String!, $organizationId: ID!, $assignmentType: DataObjectAssignmentType!, $resolution: DownloadResolution, $fileType: DownloadFileType) {
  materials(filter: {articleId: {equals: $articleId}, organizationId: {equals: $organizationId}}) {
    dataObjectAssignments(filter: {assignmentType: [$assignmentType]}) {
      dataObject {
        downloadUrl(resolution: $resolution, fileType: $fileType)
        mediaType
      }
    }
  }
}
```

{% endcode %}

For PBR maps, use this query:

{% code lineNumbers="true" %}

```graphql
query GetPbrMaterialDownloadLink($articleId: ID!, $organizationId: String!, $resolution: DownloadResolution, $fileType: DownloadFileType) {
  materials(filter: {articleId: {equals: $articleId}, organizationId: {equals: $organizationId}}) {
    jsonFileAssignments(filter: {jsonFileContent: [{resolution: $resolution, fileType: $fileType, state: "done", default: true}]}) {
      jsonFile {
        outputDataObject {
          downloadUrl
        }
      }
    }
  }
}
```

{% endcode %}

Follow [this link](https://gql.colormass.com/graphql?query=query+GetMaterialDownloadLink%28%24articleId%3A+String%21%2C+%24organizationId%3A+String%21%2C+%24assignmentType%3A+DataObjectAssignmentType%21%2C+%24resolution%3A+DownloadResolution%2C+%24fileType%3A+DownloadFileType%29+%7B%0A++++materials%28filter%3A+%7BarticleId%3A+%7Bequals%3A+%24articleId%7D%2C+organizationId%3A+%7Bequals%3A+%24organizationId%7D%7D%29+%7B%0A++++++++dataObjectAssignments%28filter%3A+%7BassignmentType%3A+%5B%24assignmentType%5D%7D%29+%7B%0A++++++++++++dataObject+%7B%0A++++++++++++++++downloadUrl%28resolution%3A+%24resolution%2C+fileType%3A+%24fileType%29%0A++++++++++++++++mediaType%0A++++++++++++%7D%0A++++++++%7D%0A++++%7D%0A%7D%0A%0Aquery+GetPbrMaterialDownloadLink%28%24articleId%3A+String%21%2C+%24organizationId%3A+String%21%2C+%24resolution%3A+DownloadResolution%2C+%24fileType%3A+DownloadFileType%29+%7B%0A++++materials%28filter%3A+%7BarticleId%3A+%7Bequals%3A+%24articleId%7D%2C+organizationId%3A+%7Bequals%3A+%24organizationId%7D%7D%29+%7B%0A++++++++jsonFileAssignments%28filter%3A+%7BjsonFileContent%3A+%5B%7Bresolution%3A+%24resolution%2C+fileType%3A+%24fileType%2C+state%3A+%22done%22%2C+default%3A+true%7D%5D%7D%29+%7B%0A++++++++++++jsonFile+%7B%0A++++++++++++++++outputDataObject+%7B%0A++++++++++++++++++++downloadUrl%0A++++++++++++++++%7D%0A++++++++++++%7D%0A++++++++%7D%0A++++%7D%0A%7D) to try the queries on live data. You will need to provide variables in this format:

{% code lineNumbers="true" %}

```json
{
 "organizationId": "<your organization id>",
 "articleId": "<article id>",
 "resolution": "High",
 "fileType": "exr",
 "assignmentType": "MaterialThumbnail_20x20"
}
```

{% endcode %}

The required link is the `downloadUrl` field of the first `dataObject` of the first `dataObjectAsssignment` returned, unless additional filter criteria apply (for example, you might want to filter by `mediaType` to exclude zip files and only offer download links to images).
