---
title: Creating and using tokens with Maps Server API
framework: applemapsserverapi
role: article
role_heading: Article
path: applemapsserverapi/creating-and-using-tokens-with-maps-server-api
---

# Creating and using tokens with Maps Server API

Sign JSON Web Tokens to use Maps Server API and debug common signing errors.

## Overview

Overview Maps Server API uses a Maps token to authenticate map initializations and other API requests, such as requests to retrieve directions or execute a search. To use a Maps token with Maps Server API you must have an Apple Developer account and obtain a Maps ID and a private key as described in Creating a Maps identifier and a private key. After getting or creating a token, confirm the success of the token authorization by using the token to access the API; check the status codes that the API responses return to verify the calls were successful. Create a token to use Maps Server API Maps Server API requires a Maps token to initialize MapKit. A Maps token has two sections, a header and a payload. The header describes the token and the cryptographic operations applied to the payload. The payload contains a set of cryptographically signed claims. Construct a token with these required fields in the header: In the payload section of the token, include the following claims: To locate your Team ID, sign in to your Apple Developer account, and click Membership in the sidebar. Your Team ID appears in the Membership information section under the team name. Generate your token by signing it with your private key. note: As a security best practice, consider creating separate tokens for each product scope. Using tokens with a single scope helps limit exposure when a token is compromised. When decoded, a token for use with Maps Server API has the following format: {     "alg": "ES256",     "kid": "ABC123DEFG",     "typ": "JWT" } {     "iss": "DEF123GHIJ",     "iat": 1437179036,     "exp": 1493298100,     "scope": "server_api",     "origin": "*.example.com" } To learn more about Maps tokens, see the JSON Web Token (JWT) specification. You can find a collection of libraries for generating signed tokens at JWT.io. For next steps, go to Generate a Maps token. Available token scopes The scope claim sets one or more Apple Maps frameworks you are authorizing the token to use. Available values are: Instead of signing a token dynamically, you can use a static token when using any Apple Maps frameworks other than Maps Server API. See Creating a Maps token.

## See Also

### Essentials

- [Creating a Maps identifier and a private key](applemapsserverapi/creating-a-maps-identifier-and-a-private-key.md)
- [Generate a Maps token](applemapsserverapi/-v1-token.md)
- [Debugging an Invalid token](applemapsserverapi/debugging-an-invalid-token.md)
- [Common objects](applemapsserverapi/common-objects.md)
- [Integrating the Apple Maps Server API into Java server applications](applemapsserverapi/integrating-the-apple-maps-server-api-into-java-server-applications.md)
