Matrak API Reference
Hello, it’s nice to meet you! Welcome to the Matrak API Reference. The Matrak API integrates into your internal tech solutions, giving everyone across your supply chain a trusted single source of truth. You’ll gain insight into your materials tracking and control over your raw data, which can then be used for analyses and reporting to your team. By creating supply chain visibility, you can mitigate potential risks to construction projects, as well as enable better communication between your team members. This API was built to allow you to edit, track and link materials in bulk. You can also create, update, delete and fetch material records. Or even link and associate materials to other containers and stillages. That’s just a few of the many things you can do with the Matrak API. This reference was written to guide you on its many capabilities, what you can do and how you can easily execute these features into your own tech solutions.
Terms of Service
API Endpoints
https://graphql.matrak.com.au/
Headers
Authorization: <YOUR_TOKEN_HERE>
Version
1.0.0
Getting Started
Authentication To access our APIs, you need an authentication key (API key). To obtain your API key, please contact our technical support team at [email protected]. Once you have your API key, include it in your requests to authenticate and interact with our services. Using the API Explorer You can explore and test our API using the Matrak GraphQL Explorer, available at https://graphql.matrak.com.au/. This web-based tool allows you to run queries and mutations against our live production data. Please use caution when making changes, as they will directly impact the live environment.
Sandbox Environment
Overview Our Sandbox environment provides a safe and fully functional replica of our production environment, allowing developers to test their API integrations without affecting live production data. This environment is synced with production data daily, ensuring it remains up-to-date. Access The Sandbox environment can be accessed at https://sandbox.matrak.com.au/. Using the GraphQL Editor Developers can test their API usage in the GraphQL editor available at https://graphql.sandbox.matrak.com.au/.
Changelog
Future changes in this document will reflect changes in our API's
Queries
Project
Description
Get a specific Project
Record
Description
Get a specific Record
Example
Query
query Record($id: Int) {
Record(id: $id) {
id
record_id
project {
...ProjectFragment
}
record_type {
...RecordTypeFragment
}
values {
...RecordValueFragment
}
value {
...RecordValueFragment
}
attachments {
...AttachmentFragment
}
childLink {
...LinkFragment
}
parentLink {
...LinkFragment
}
}
}
Variables
{"id": 987}
Response
{
"data": {
"Record": {
"id": 987,
"record_id": "abc123",
"project": Project,
"record_type": RecordType,
"values": [RecordValue],
"value": RecordValue,
"attachments": [Attachment],
"childLink": [Link],
"parentLink": [Link]
}
}
}
RecordType
Description
Get a specific Record Type
Response
Returns a
RecordType
Arguments
Name | Description |
---|---|
id -
Int
|
Example
Query
query RecordType($id: Int) {
RecordType(id: $id) {
id
name
category
sub_category
order
descriptions {
...DescriptionFragment
}
}
}
Variables
{"id": 987}
Response
{
"data": {
"RecordType": {
"id": 123,
"name": "xyz789",
"category": "abc123",
"sub_category": "xyz789",
"order": 987,
"descriptions": [Description]
}
}
}
Trade
_allRecordTypesMeta
Description
Get metadata about how many Record Types would be available after a filter is applied
Response
Returns a
ListMetadata!
Arguments
Name | Description |
---|---|
page -
Int
|
|
perPage -
Int
|
|
sortField -
String
|
|
sortOrder -
String
|
|
filter -
RecordTypeFilter
|
Example
Query
query _allRecordTypesMeta(
$page: Int,
$perPage: Int,
$sortField: String,
$sortOrder: String,
$filter: RecordTypeFilter
) {
_allRecordTypesMeta(
page: $page,
perPage: $perPage,
sortField: $sortField,
sortOrder: $sortOrder,
filter: $filter
) {
count
}
}
Variables
{
"page": 987,
"perPage": 987,
"sortField": "xyz789",
"sortOrder": "abc123",
"filter": RecordTypeFilter
}
Response
{"data": {"_allRecordTypesMeta": {"count": 987}}}
_allRecordsMeta
Description
Get metadata about how many records would be available after a filter is applied
Response
Returns a
ListMetadata!
Arguments
Name | Description |
---|---|
page -
Int
|
|
perPage -
Int
|
|
sortField -
String
|
|
sortOrder -
String
|
|
filter -
RecordFilter
|
Example
Query
query _allRecordsMeta(
$page: Int,
$perPage: Int,
$sortField: String,
$sortOrder: String,
$filter: RecordFilter
) {
_allRecordsMeta(
page: $page,
perPage: $perPage,
sortField: $sortField,
sortOrder: $sortOrder,
filter: $filter
) {
count
}
}
Variables
{
"page": 123,
"perPage": 987,
"sortField": "xyz789",
"sortOrder": "xyz789",
"filter": RecordFilter
}
Response
{"data": {"_allRecordsMeta": {"count": 123}}}
_allTradeMeta
Response
Returns a
ListMetadata
Arguments
Name | Description |
---|---|
page -
Int
|
|
perPage -
Int
|
|
sortField -
String
|
|
sortOrder -
String
|
|
filter -
TradeFilter
|
Example
Query
query _allTradeMeta(
$page: Int,
$perPage: Int,
$sortField: String,
$sortOrder: String,
$filter: TradeFilter
) {
_allTradeMeta(
page: $page,
perPage: $perPage,
sortField: $sortField,
sortOrder: $sortOrder,
filter: $filter
) {
count
}
}
Variables
{
"page": 987,
"perPage": 987,
"sortField": "xyz789",
"sortOrder": "xyz789",
"filter": TradeFilter
}
Response
{"data": {"_allTradeMeta": {"count": 987}}}
allLinks
Description
Get a list of associated linked Records with relationship
Response
Returns
[Link]
Example
Query
query allLinks {
allLinks {
id
primary {
...RecordFragment
}
secondary {
...RecordFragment
}
relationship
}
}
Response
{
"data": {
"allLinks": [
{
"id": 987,
"primary": Record,
"secondary": Record,
"relationship": "abc123"
}
]
}
}
allProjects
Description
Get all projects for your company
Response
Returns
[Project!]!
Arguments
Name | Description |
---|---|
page -
Int
|
|
perPage -
Int
|
|
sortField -
String
|
|
sortOrder -
String
|
|
filter -
ProjectFilter
|
Example
Query
query allProjects(
$page: Int,
$perPage: Int,
$sortField: String,
$sortOrder: String,
$filter: ProjectFilter
) {
allProjects(
page: $page,
perPage: $perPage,
sortField: $sortField,
sortOrder: $sortOrder,
filter: $filter
) {
id
name
}
}
Variables
{
"page": 987,
"perPage": 123,
"sortField": "xyz789",
"sortOrder": "xyz789",
"filter": ProjectFilter
}
Response
{
"data": {
"allProjects": [
{"id": 123, "name": "abc123"}
]
}
}
allRecordTypes
Description
Get a all the Record Types
Response
Returns
[RecordType!]!
Arguments
Name | Description |
---|---|
page -
Int
|
|
perPage -
Int
|
|
sortField -
String
|
|
sortOrder -
String
|
|
filter -
RecordTypeFilter
|
Example
Query
query allRecordTypes(
$page: Int,
$perPage: Int,
$sortField: String,
$sortOrder: String,
$filter: RecordTypeFilter
) {
allRecordTypes(
page: $page,
perPage: $perPage,
sortField: $sortField,
sortOrder: $sortOrder,
filter: $filter
) {
id
name
category
sub_category
order
descriptions {
...DescriptionFragment
}
}
}
Variables
{
"page": 123,
"perPage": 123,
"sortField": "abc123",
"sortOrder": "abc123",
"filter": RecordTypeFilter
}
Response
{
"data": {
"allRecordTypes": [
{
"id": 123,
"name": "xyz789",
"category": "xyz789",
"sub_category": "xyz789",
"order": 123,
"descriptions": [Description]
}
]
}
}
allRecords
Description
Get a list of Records
Response
Returns
[Record!]!
Arguments
Name | Description |
---|---|
page -
Int
|
|
perPage -
Int
|
|
sortField -
String
|
|
sortOrder -
String
|
|
filter -
RecordFilter
|
Example
Query
query allRecords(
$page: Int,
$perPage: Int,
$sortField: String,
$sortOrder: String,
$filter: RecordFilter
) {
allRecords(
page: $page,
perPage: $perPage,
sortField: $sortField,
sortOrder: $sortOrder,
filter: $filter
) {
id
record_id
project {
...ProjectFragment
}
record_type {
...RecordTypeFragment
}
values {
...RecordValueFragment
}
value {
...RecordValueFragment
}
attachments {
...AttachmentFragment
}
childLink {
...LinkFragment
}
parentLink {
...LinkFragment
}
}
}
Variables
{
"page": 123,
"perPage": 123,
"sortField": "xyz789",
"sortOrder": "abc123",
"filter": RecordFilter
}
Response
{
"data": {
"allRecords": [
{
"id": 987,
"record_id": "xyz789",
"project": Project,
"record_type": RecordType,
"values": [RecordValue],
"value": RecordValue,
"attachments": [Attachment],
"childLink": [Link],
"parentLink": [Link]
}
]
}
}
allTrades
Response
Returns
[Trade]!
Arguments
Name | Description |
---|---|
page -
Int
|
|
perPage -
Int
|
|
sortField -
String
|
|
sortOrder -
String
|
|
filter -
TradeFilter
|
Example
Query
query allTrades(
$page: Int,
$perPage: Int,
$sortField: String,
$sortOrder: String,
$filter: TradeFilter
) {
allTrades(
page: $page,
perPage: $perPage,
sortField: $sortField,
sortOrder: $sortOrder,
filter: $filter
) {
id
name
created_at
updated_at
}
}
Variables
{
"page": 123,
"perPage": 123,
"sortField": "xyz789",
"sortOrder": "xyz789",
"filter": TradeFilter
}
Response
{
"data": {
"allTrades": [
{
"id": 123,
"name": "abc123",
"created_at": "abc123",
"updated_at": "xyz789"
}
]
}
}
getRecordTypeTemplates
Response
Returns
[RecordType!]!
Example
Query
query getRecordTypeTemplates {
getRecordTypeTemplates {
id
name
category
sub_category
order
descriptions {
...DescriptionFragment
}
}
}
Response
{
"data": {
"getRecordTypeTemplates": [
{
"id": 987,
"name": "abc123",
"category": "xyz789",
"sub_category": "abc123",
"order": 123,
"descriptions": [Description]
}
]
}
}
link
Description
Get associated linked Records with relationship
Example
Query
query link($id: String!) {
link(id: $id) {
id
primary {
...RecordFragment
}
secondary {
...RecordFragment
}
relationship
}
}
Variables
{"id": "abc123"}
Response
{
"data": {
"link": {
"id": 123,
"primary": Record,
"secondary": Record,
"relationship": "abc123"
}
}
}
Mutations
createLinks
Description
Create a link or association between two records
Response
Returns an
Int!
Arguments
Name | Description |
---|---|
project_id -
Int!
|
|
createLinksInput -
[LinkInput!]!
|
Example
Query
mutation createLinks(
$project_id: Int!,
$createLinksInput: [LinkInput!]!
) {
createLinks(
project_id: $project_id,
createLinksInput: $createLinksInput
)
}
Variables
{"project_id": 987, "createLinksInput": [LinkInput]}
Response
{"data": {"createLinks": 987}}
createProject
Response
Returns a
CreateProjectResponse!
Arguments
Name | Description |
---|---|
createProjectInput -
CreateProjectInput
|
Example
Query
mutation createProject($createProjectInput: CreateProjectInput) {
createProject(createProjectInput: $createProjectInput) {
project {
...ProjectFragment
}
companyProjectId
}
}
Variables
{"createProjectInput": CreateProjectInput}
Response
{
"data": {
"createProject": {
"project": Project,
"companyProjectId": 987
}
}
}
createRecords
Description
Create one or many Records
Response
Returns
[Record]!
Arguments
Name | Description |
---|---|
project_id -
Int!
|
|
createRecordsInput -
[CreateRecordInput!]!
|
Example
Query
mutation createRecords(
$project_id: Int!,
$createRecordsInput: [CreateRecordInput!]!
) {
createRecords(
project_id: $project_id,
createRecordsInput: $createRecordsInput
) {
id
record_id
project {
...ProjectFragment
}
record_type {
...RecordTypeFragment
}
values {
...RecordValueFragment
}
value {
...RecordValueFragment
}
attachments {
...AttachmentFragment
}
childLink {
...LinkFragment
}
parentLink {
...LinkFragment
}
}
}
Variables
{
"project_id": 123,
"createRecordsInput": [CreateRecordInput]
}
Response
{
"data": {
"createRecords": [
{
"id": 987,
"record_id": "abc123",
"project": Project,
"record_type": RecordType,
"values": [RecordValue],
"value": RecordValue,
"attachments": [Attachment],
"childLink": [Link],
"parentLink": [Link]
}
]
}
}
deleteRecords
Description
Delete one or many Records
Response
Returns an
Int!
Arguments
Name | Description |
---|---|
filter -
RecordFilter!
|
|
sourceApp -
String
|
|
sourceDevice -
String
|
Example
Query
mutation deleteRecords(
$filter: RecordFilter!,
$sourceApp: String,
$sourceDevice: String
) {
deleteRecords(
filter: $filter,
sourceApp: $sourceApp,
sourceDevice: $sourceDevice
)
}
Variables
{
"filter": RecordFilter,
"sourceApp": "abc123",
"sourceDevice": "abc123"
}
Response
{"data": {"deleteRecords": 123}}
removeLinks
Description
Remove link or association between two records
Response
Returns an
Int!
Arguments
Name | Description |
---|---|
removeLinksInput -
[LinkInput!]!
|
Example
Query
mutation removeLinks($removeLinksInput: [LinkInput!]!) {
removeLinks(removeLinksInput: $removeLinksInput)
}
Variables
{"removeLinksInput": [LinkInput]}
Response
{"data": {"removeLinks": 123}}
updateRecords
Description
Update one or many Records
Response
Returns an
Int
Arguments
Name | Description |
---|---|
filter -
RecordFilter!
|
|
values -
[RecordValueUpdate!]!
|
|
sourceApp -
String
|
|
sourceDevice -
String
|
Example
Query
mutation updateRecords(
$filter: RecordFilter!,
$values: [RecordValueUpdate!]!,
$sourceApp: String,
$sourceDevice: String
) {
updateRecords(
filter: $filter,
values: $values,
sourceApp: $sourceApp,
sourceDevice: $sourceDevice
)
}
Variables
{
"filter": RecordFilter,
"values": [RecordValueUpdate],
"sourceApp": "xyz789",
"sourceDevice": "abc123"
}
Response
{"data": {"updateRecords": 987}}
Types
Attachment
Description
Represents a user-uploaded file associated with a record, including its metadata and access information
Example
{
"id": 987,
"format": "abc123",
"data": "xyz789",
"url": "xyz789"
}
Boolean
Description
The Boolean
scalar type represents true
or false
CreateProjectInput
CreateProjectResponse
CreateRecordInput
Fields
Input Field | Description |
---|---|
record_type_id -
Int!
|
Type ID for this record. Eg: 1234 |
record_id -
String!
|
Humanized Record ID eg: Window 001 |
values -
[RecordValueCreate!]
|
Object contains properties descriptionID and value |
Example
{
"record_type_id": 123,
"record_id": "abc123",
"values": [RecordValueCreate]
}
Date
Description
Date custom scalar type
Example
"2007-12-03"
Description
Fields
Field Name | Description |
---|---|
id -
Int!
|
|
recordType -
RecordType!
|
|
name -
String!
|
|
type -
String!
|
|
order -
Int
|
|
listValues -
[ListValue!]
|
Example
{
"id": 987,
"recordType": RecordType,
"name": "abc123",
"type": "abc123",
"order": 987,
"listValues": [ListValue]
}
FitEnum
Description
Enum for image resizing strategies
Values
Enum Value | Description |
---|---|
|
Preserves aspect ratio; fits within given dimensions |
|
Preserves aspect ratio; fills the given dimensions |
|
Does not preserve aspect ratio; stretches to fill dimensions |
|
Preserves aspect ratio; fits within given dimensions, without cropping |
|
Preserves aspect ratio; fills given dimensions, may overflow |
Example
"contain"
ImageResize
Int
Description
The Int
scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1
Example
987
Link
LinkInput
ListMetadata
Fields
Field Name | Description |
---|---|
count -
Int!
|
Example
{"count": 123}
ListValue
Project
ProjectFilter
Fields
Input Field | Description |
---|---|
id -
Int
|
|
ids -
[Int]
|
|
name -
String
|
|
name__like -
String
|
|
company_id -
Int
|
|
address -
String
|
|
address__like -
String
|
|
owner -
String
|
|
owner__like -
String
|
|
contact_details -
String
|
|
contact_details__like -
String
|
|
comments -
String
|
|
comments__like -
String
|
|
start_date -
String
|
|
start_date__gte -
Date
|
|
start_date__lte -
Date
|
|
start_date__like -
String
|
|
end_date -
String
|
|
end_date__gte -
Date
|
|
end_date__lte -
Date
|
|
end_date__like -
String
|
|
created_at -
String
|
|
created_at__gte -
Date
|
|
created_at__lte -
Date
|
|
created_at__like -
String
|
|
updated_at -
String
|
|
updated_at__like -
String
|
|
classification -
String
|
|
classification__in -
[String]
|
|
hubspot_id -
String
|
|
hubspot_ids -
[String]
|
|
bci_id -
String
|
|
bci_ids -
[String]
|
|
is_archived -
Boolean
|
|
archived_at -
String
|
|
archived_at__gte -
Date
|
|
archived_at__lte -
Date
|
|
archived_at__like -
String
|
|
user_access -
Int
|
Filter by user access, currently super user bahaviour is not implemented, same as normal user |
Example
{
"id": 123,
"ids": [123],
"name": "xyz789",
"name__like": "xyz789",
"company_id": 123,
"address": "xyz789",
"address__like": "abc123",
"owner": "abc123",
"owner__like": "abc123",
"contact_details": "abc123",
"contact_details__like": "xyz789",
"comments": "xyz789",
"comments__like": "xyz789",
"start_date": "abc123",
"start_date__gte": "2007-12-03",
"start_date__lte": "2007-12-03",
"start_date__like": "xyz789",
"end_date": "xyz789",
"end_date__gte": "2007-12-03",
"end_date__lte": "2007-12-03",
"end_date__like": "xyz789",
"created_at": "xyz789",
"created_at__gte": "2007-12-03",
"created_at__lte": "2007-12-03",
"created_at__like": "xyz789",
"updated_at": "xyz789",
"updated_at__like": "abc123",
"classification": "abc123",
"classification__in": ["abc123"],
"hubspot_id": "xyz789",
"hubspot_ids": ["xyz789"],
"bci_id": "abc123",
"bci_ids": ["xyz789"],
"is_archived": false,
"archived_at": "xyz789",
"archived_at__gte": "2007-12-03",
"archived_at__lte": "2007-12-03",
"archived_at__like": "xyz789",
"user_access": 987
}
Record
Fields
Field Name | Description |
---|---|
id -
Int!
|
The globally unique ID for a record eg: 100023 |
record_id -
String
|
Humanized Record ID eg: Window 001 |
project -
Project
|
The details of the project this record belongs to, e.g. Melbourne Hotel |
record_type -
RecordType!
|
Type details for this record. E.g. Joinery |
values -
[RecordValue!]!
|
An array of values that this record has, e.g: WIN-0001, Complete |
Arguments
|
|
value -
RecordValue
|
Get a specific value for a record |
Arguments
|
|
attachments -
[Attachment!]!
|
An array of attachments that this record has |
Arguments
|
|
childLink -
[Link]
|
Child materials that belong to this record |
parentLink -
[Link]
|
Parent materials that belong to this record |
Example
{
"id": 123,
"record_id": "abc123",
"project": Project,
"record_type": RecordType,
"values": [RecordValue],
"value": RecordValue,
"attachments": [Attachment],
"childLink": [Link],
"parentLink": [Link]
}
RecordFilter
Fields
Input Field | Description |
---|---|
ids -
[Int]
|
Filter records that are passed in the array of IDS |
id -
Int
|
Filter record by internal database id. This is different than the 'ID' description on the actual record. The internal database ID is what is returned in the 'id' field of a Record |
record_id -
String
|
Filter records exactly matching this 'ID' description value. This is different than the internal database ID |
record_ids -
[String]
|
Filter record exactly matching this 'ID' description value. This is different than the internal database ID |
record_type_name -
String
|
Filter records that have this record type name |
record_type_id -
Int
|
Filter records that have this record type id |
record_type_ids -
[Int]
|
Filter records that have this record type ids |
record_value -
RecordFilterByRecordValueFilter
|
Filter the records to those containing a certain record value |
record_values -
RecordFilterByRecordValuesFilter
|
Filter the records to those each of these record values |
project_name -
String
|
Filter the records to a specific project by name |
project_id -
Int
|
Filter the records that are part of a specific project by id |
Example
{
"ids": [987],
"id": 987,
"record_id": "xyz789",
"record_ids": ["abc123"],
"record_type_name": "xyz789",
"record_type_id": 123,
"record_type_ids": [987],
"record_value": RecordFilterByRecordValueFilter,
"record_values": RecordFilterByRecordValuesFilter,
"project_name": "xyz789",
"project_id": 987
}
RecordFilterByRecordValueFilter
RecordFilterByRecordValuesFilter
Fields
Input Field | Description |
---|---|
values -
[RecordFilterByRecordValueFilter]
|
Object containing possible properties to filter by |
Example
{"values": [RecordFilterByRecordValueFilter]}
RecordType
RecordTypeCategory
Values
Enum Value | Description |
---|---|
|
|
|
|
|
|
|
|
|
|
|
Example
"container"
RecordTypeFilter
Fields
Input Field | Description |
---|---|
ids -
[Int]
|
|
project_id -
Int
|
|
category -
RecordTypeCategory
|
Example
{"ids": [987], "project_id": 123, "category": "container"}
RecordValue
Fields
Field Name | Description |
---|---|
id -
Int!
|
A globally unique identifier for this Record Value |
value -
String!
|
The value of a record |
description -
Description!
|
The description details of this record value, e.g. name: ID, type: text |
Example
{
"id": 987,
"value": "xyz789",
"description": Description
}
RecordValueCreate
RecordValueUpdate
Fields
Input Field | Description |
---|---|
description_name -
String
|
Specify either a specific description, or descriptions matching a name for which this record update should apply for |
description_id -
Int
|
Specific the existing description ID |
value -
String!
|
The new record value to apply |
updateChildren -
Boolean
|
Mark this update to be applied to materials/subcomponents contained withing this record |
Example
{
"description_name": "xyz789",
"description_id": 123,
"value": "xyz789",
"updateChildren": false
}
RecordsUpdatedEvent
Fields
Field Name | Description |
---|---|
ids -
[Int!]!
|
|
updates -
[UpdateRecordsArgs!]!
|
Example
{"ids": [987], "updates": [UpdateRecordsArgs]}
String
Description
The String
scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text
Example
"xyz789"
Trade
TradeFilter
Example
{
"id": 123,
"ids": [987],
"name": "xyz789",
"name__like": "abc123",
"created_at": "abc123",
"created_at__like": "abc123",
"updated_at": "abc123",
"updated_at__like": "xyz789"
}
UpdateRecordsArgs
Subscriptions
recordsUpdated
Response
Returns a
RecordsUpdatedEvent
Arguments
Name | Description |
---|---|
project_id -
Int!
|
Example
Query
subscription recordsUpdated($project_id: Int!) {
recordsUpdated(project_id: $project_id) {
ids
updates {
...UpdateRecordsArgsFragment
}
}
}
Variables
{"project_id": 123}
Response
{
"data": {
"recordsUpdated": {
"ids": [987],
"updates": [UpdateRecordsArgs]
}
}
}