Skip to main content

Account API Code Snippets

This is a library of ready-to-use sample GraphQL queries and mutations for Matterport's Account API.

Each query and mutation contains a link to try the query in our interactive console. Be sure to edit the variables, when provided, and insert a valid Model ID and valid data for all variables.

note

Account API is only available for Enterprise-level Matterport Subscriptions

If you would like an application to build collections of API queries for testing and generating code to use in your applications, we recommend using Postman

If you are needing assistance with building queries, refer to our API schema.

Organization and Member Management

Get organization info

Fragments can be mixed and matched depending on which data you want. The organization ID is based on which API tokens are used.

query getOrganizationInfo {
organization {
name
created
developer {
...developerInfo
}
sdkKeys {
...sdkKeyInfo
}
bundles {
...bundleInfo
}
}
}

fragment developerInfo on DeveloperAccount {
mode
license {
availability
}
}

fragment sdkKey on SdkKey {
key
label
domains {
created
secureOnly
domain
port
}
}

fragment sdkKeyInfo on SdkKeyDetails {
used
remaining
quota
keys(active: true) {
...sdkKey
}
}

fragment bundleInfo on OrganizationBundle {
id
name
description
enabled
}

Sample Response:

{
"data": {
"organization": {
"name": "Matterport Organization",
"created": "2020-11-03T21:43:39Z",
"developer": {
"mode": "production",
"license": {
"availability": "unlocked"
}
},
"sdkKeys": {
"used": 1,
"remaining": 4,
"quota": 5,
"keys": [{
"key": "XXXXXXXXXXXXXXXXXX",
"domains": [{
"created": "1605138155932",
"secureOnly": false,
"domain": "localhost"
}]
},
"bundles": [{
"id": "mp:matterpak",
"name": "Matterpak",
"description": "Order high resolution assets associated with the model.",
"enabled": true
},
{
"id": "cubicasa:floorplan",
"name": "Cubicasa Schematic Floorplan",
"description": "Order an enhanced schematic floorplan",
"enabled": true
},
{
"id": "trueplan:schematic",
"name": "TruePlan™ Schematic",
"description": "Order a TruePlan™ Schematic",
"enabled": false
},
{
"id": "gsv:publish",
"name": "Google Street View",
"description": "Publish to Google Street View",
"enabled": true
},
{
"id": "homeaway:publish",
"name": "Vrbo - HomeAway",
"description": "Create a 360 Tour for Vrbo and HomeAway",
"enabled": true
}
]
}
}
}

Try this in our interactive console

Get organization members info

Results might need to be paginated (offset pagination).

Optional - you can specify a text string within the 'query' field to filter results that contain the query string within the email, firstName or lastName fields.

query getOrganizationInfo {
organization {
memberships(
query: "",
pageSize: 100,
offset: null
){
nextOffset,
results{
user {
...user
}
roles{
id
name
}
status
}
}
}
}

fragment user on User {
id
firstName
lastName
email
created
}

Sample Response:

{
"data": {
"organization": {
"memberships": {
"results": [{
"user": {
"id": "XXXXXXXXXXX",
"firstName": "XXX",
"lastName": "XXXXXXX",
"email": "XXXXXX@XXXXXX.com",
"created": "2020-11-03T21:43:39Z"
},
"roles": [{
"id": "00000000200",
"name": "owner"
},
{
"id": "00000000080",
"name": "billing-admin"
},
{
"id": "00000000120",
"name": "admin"
}
],
"status": "active"
},
{
"user": {
"id": "XXXXXXXXXXX",
"firstName": "XXX",
"lastName": "XXXXXXX",
"email": "XXXXXXX@XXXXX.com",
"created": "2022-05-03T22:05:00Z"
},
"roles": [{
"id": "00000000120",
"name": "admin"
}],
"status": "active"
},
{
"user": {
"id": "XXXXXXXXXXX",
"firstName": "XXX",
"lastName": "XXXXXXX",
"email": "XXXXXXX@XXXXX.com",
"created": "2021-03-09T20:33:57Z"
},
"roles": [{
"id": "00000000100",
"name": "collaborator"
}],
"status": "active"
},
]
}
}
}

Try this in our interactive console

Invite user to organization
mutation inviteUser($userEmail: String!, $roleId: ID!, $inviteMessage: String){
inviteMember(
email: $userEmail
roleId: $roleId
inviteMessage: $inviteMessage
){
user{email}
status
}
}

# Variables
{
"userEmail": "",
"roleId": "",
"inviteMessage": "Please accept the invitation to this organization."
}

# Role ID reference:
# collaborator = 00000000100
# admin = 00000000120
# owner = 00000000200
# billing-admin = 00000000080

Sample Response:

{
"data": {
"inviteMember": {
"user": {
"email": "XXXXXXX@XXXXX.com"
},
"status": "pending"
}
}
}

Try this in our interactive console

Remove user from organization
mutation removeMember($email: String!){
removeMembership(email: $email){
user{email}
status
}
}

# variables
{
"email": ""
}

Sample Response:

{
"data": {
"removeMembership": {
"user": {
"email": "XXXXXXX@XXXXX.com"
},
"status": "deleted"
}
}
}

Try this in our interactive console

Update a user's role
mutation updateUserRole($email: String!, $roleId: ID!){
patchMembership(email: $email, roleId: $roleId){
user{email}
roles{
id
name
}
}
}

# variables
{
"email": "",
"roleId": ""
}

# Role ID reference:
# collaborator = 00000000100
# admin = 00000000120
# owner = 00000000200
# billing-admin = 00000000080

Sample Response:

{
"data": {
"patchMembership": {
"user": {
"email": "XXXXXXX@XXXXX.com"
},
"roles": [{
"id": "00000000100",
"name": "collaborator"
}]
}
}
}

Try this in our interactive console

Developer Key Management

List SDK Keys
query getSDKKeys {
organization {
sdkKeys {
quota
used
remaining
keys{ ...keyInfo }
}
}
}

fragment keyInfo on SdkKey {
key
domains{
secureOnly
domain
port
}
}

Sample Response:

{
"data": {
"organization": {
"sdkKeys": {
"quota": 5,
"used": 5,
"remaining": 0,
"keys": [{
"key": "08s53auxt9txz1w6hx2iww1qb",
"domains": [{
"secureOnly": false,
"domain": "127.0.0.1",
"port": 8000
},
{
"secureOnly": true,
"domain": "my.matterport.com",
"port": null
},
{
"secureOnly": false,
"domain": "localhost",
"port": 8000
},
...
]
}]
}
}
}
}

Try this in our interactive console

Add SDK Key
fragment sdkKey on SdkKey{
key
label
domains{
secureOnly
domain
}
}

mutation addSdkKey($label: String, $domains: [AddSdkDomain!]){
provisionSdkKey(
label: $label
domains: $domains
){
...sdkKey
}
}

# variables
{
"label": "My SDK Key",
"domains": [
{
"domain": "http://localhost",
"secureOnly": false,
"port": 8000
}
]
}

Try this in our interactive console

Delete SDK Key
mutation removeSdkKey($key: ID!){
removeSdkKey(key: $key)
}

# variables

{
"key": ""
}

Try this in our interactive console

Add domain to SDK key
mutation addDomain($key: ID!, $domainDetails: AddSdkDomain!){
addSdkDomain(key: $key, details: $domainDetails){
domain
secureOnly
}
}

# variables

{
"key": "",
"domainDetails": {
"domain": "http://localhost",
"secureOnly": false,
"port": 8000
}
}

Try this in our interactive console

Remove domain from SDK key
mutation removeDomain($key: ID!, $domainId: ID!){
removeSdkDomain(key: $key, domainId: $domainId)
}

# variables
{
"key": "",
"domainId": ""
}

Try this in our interactive console

Update domain on SDK key
mutation updateDomain($key: ID!, $domainId: ID!, $newInfo: PatchSdkDomain!){
patchSdkDomain(key: $key, domainId: $domainId, patch: $newInfo){
id
secureOnly
domain
port
}
}

# variables
{
"key": "",
"domainId": "",
"newInfo": {
"domain": "http://localhost",
"secureOnly": false,
"port": 6000
}
}

Try this in our interactive console