---
title: NerdGraph tutorial: Mobile agent monitoring examples
source: https://docs.newrelic.com/docs/apis/nerdgraph/examples/mobile-monitoring-config-nerdgraph
---

You can create mobile applications in the NerdGraph API instead of using the UI. The advantage to this is that when it's time to instrument your mobile application with New Relic, you can programmatically create and retrieve the application token to copy and paste into your mobile application.

## Create a new mobile application [#create-mobile]

Here is an example mutation to create a new mobile application. You must provide an account ID and a name for the application.

Mutation:

```graphql
mutation CreateExampleMobileApplication($accountId: Int!, $name: String!) {
  agentApplicationCreateMobile(accountId: $accountId, name: $name) {
    accountId
    applicationToken
    guid
    name
  }
}
```

Variables:

```json
{
  "accountId": Int!,
  "name": String!
}
```

## Retrieving the application token [#get-mobile-token]

You can retrieve a mobile application token with the following query.

Query:

```graphql
query FetchMobileApplicationToken($guid: EntityGuid!) {
  actor {
    entity(guid: "") {
      ... on MobileApplicationEntity {
        guid
        name
        mobileProperties {
          applicationToken
        }
      }
    }
  }
}
```

Variables:

```json
{
  "guid": EntityGuid!
}
```

## Change a mobile app name [#configure-mobile-application]

Here's an example mutation that changes the name of your mobile app in New Relic:

Mutation:

```graphql
mutation UpdateMobileApplicationAlias(
    $guid: EntityGuid!, 
    $settings: $AgentApplicationSettingsUpdateInput
) {
  agentApplicationSettingsUpdate(guid: $guid, settings: $settings) {
    alias
    guid
    errors {
      description
      errorClass
      field
    }
  }
}
```

Variables:

```json
{
  "guid": EntityGuid!,
  "settings": {
    "alias": String
  }
}
```

## Examples of configuring mobile monitoring [#configure-mobile-application]

Here's an example of how to configure mobile monitoring settings via NerdGraph:

Mutation:

```graphql
mutation UpdateMobileSettingsExample(
  $guid: EntityGuid!
  $settings: AgentApplicationSettingsUpdateInput!
) {
  agentApplicationSettingsUpdate(guid: $guid, settings: $settings) {
    guid
    errors {
      description
      errorClass
      field
    }
    alias
    mobileSettings {
      networkSettings {
        aliases {
          alias
          hosts
        }
        filterMode
        hideList
        ignoredStatusCodeRules {
          hosts
          statusCodes
        }
        showList
      }
      useCrashReports
    }
  }
}
```

Variables:

```json
{
  "guid": EntityGuid!,
  "settings": {
    "alias": String,
    "mobileSettings": {
      "networkSettings": {
        "aliases": [
          {
            "alias": String!,
            "hosts": [String!]!
          }
        ],
        "filterMode": AgentApplicationSettingsNetworkFilterMode,
        "hideList": [String!],
        "ignoredStatusCodeRules": [
          {
            "hosts": [String!]!,
            "statusCodes": [String!]!
          }
        ],
        "showList": [String!]
      },
      "useCrashReports": Boolean
    }
  }
}
```
