---
title: "Create an access token "
description: >
  Create an access token to grant authorization for using [Storefront APIs](https://developer.shopline.com/docs/apps/api-instructions-for-use/storefront-api/overview.md).
doc_type: openapi
doc_category: openapi
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/docs/admin-rest-api/access/storefront-api/create-an-access-token'
  md: 'https://developer.shopline.com/docs/admin-rest-api/access/storefront-api/create-an-access-token.md'
---
# Create an access token 

Create an access token to grant authorization for using [Storefront APIs](https://developer.shopline.com/docs/apps/api-instructions-for-use/storefront-api/overview.md).

- **Base URL:** `https://{handle}.myshopline.com/admin/openapi`
- **API Version:** v20270301
- **API Type:** Admin
- **API Protocol:** RESTful

## Endpoint

```http
POST /storefront_access_tokens.json
```

## Base URL

* `https://{handle}.myshopline.com/admin/openapi`

  * `{handle}`: `handle` : The store's unique identifier, which is the prefix of the store's domain name. For example, if a store's domain name is `open001.myshopline.com` , the store handle is `open001` .

## Request

### Request Headers

* `Content-Type`

  string (required)

  The field must be set to the fixed value `application/json; charset=utf-8`.

* `Authorization`

  string (required)

   The access token for the API resource. Refer to [App authorization](https://developer.shopline.com/docs/apps/api-instructions-for-use/app-authorization.md?lang=en) to obtain the access token, and then pass the obtained token in the Bearer format. 

### Request Body

* `storefront_access_token`

  object

  The access token information. 

  * `title`

    string

    The title of the access token. Used to mark the scenario of the access token.

## Response

### Status Codes

* `200`

  For the complete list of codes and messages, see [Http status code](https://developer.shopline.com/docs/apps/api-instructions-for-use/http-status-code.md?lang=en).

* `401`

  

* `429`

  

### Response Headers

* `traceId`

  A globally unique identifier for the request. It is used to track the request flow throughout the system, allowing for easy location and debugging when issues arise.

### Response Body

#### 200

* `storefront_access_token`

  object

  The access token information.

  * `access_scope`

    string

    Access scopes, defining which APIs the returned access token is allowed to call. Multiple [access scopes](https://developer.shopline.com/docs/apps/api-instructions-for-use/access-scope.md) are separated by `,`.

  * `access_token`

    string

    Access token. This access token must be included in requests when calling Storefront APIs. The system will validate interface request permissions through this access token.
    
    

  * `created_at`

    string

    The date and time when the access token was created. Format: [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). 

  * `id`

    string

    The unique identifier for the access token. 

  * `title`

    string

    The title of the access token.


#### 401

* `errors`

  string

  Error message. 


#### 429

* `errors`

  string

  Error message. 


## OpenAPI Definition

```json
{
  "tags": [
    "Create an access token "
  ],
  "description": "Create an access token to grant authorization for using [Storefront APIs](https://developer.shopline.com/docs/apps/api-instructions-for-use/storefront-api/overview.md).",
  "externalDocs": {
    "url": "",
    "errorTableDescription": "| Error Code | HTTP Status Code | Error Description |\n|------------|------------------|-------------------|\n| TOO_MANY_REQUESTS | 429 | You sent too many requests. |\n| DATA_NOT_EXIST | 404 | The requested data does not exist. |\n| QUANTITY_EXCEEDS_LIMIT | 400 | The quantity exceeds the limit. |\n| SUCCESS | 200 | request success |\n| SYSTEM_ERROR | 500 | system error |\n| PARAM_ILLEGAL | 422 | illegal param |\n| APP_NOT_INSTALL | 400 | The current app is not installed on this store. |\n"
  },
  "operationId": "k4uSlCgC",
  "parameters": [
    {
      "name": "Content-Type",
      "in": "header",
      "description": "The field must be set to the fixed value `application/json; charset=utf-8`.",
      "required": true,
      "schema": {
        "name": "Content-Type",
        "type": "string",
        "example": "application/json; charset=utf-8"
      }
    },
    {
      "name": "Authorization",
      "in": "header",
      "description": " The access token for the API resource. Refer to [App authorization](https://developer.shopline.com/docs/apps/api-instructions-for-use/app-authorization.md?lang=en) to obtain the access token, and then pass the obtained token in the Bearer format. ",
      "required": true,
      "style": "string",
      "schema": {
        "name": "Authorization",
        "description": " The access token for the API resource. Refer to [App authorization](https://developer.shopline.com/docs/apps/api-instructions-for-use/app-authorization.md?lang=en) to obtain the access token, and then pass the obtained token in the Bearer format. ",
        "type": "string",
        "example": "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6MCwiYXBwS2V5IjoiNzU2ZjI1NWE2NjdlZTcwNTk1MzM0ZjVjYzk4NzU5MzBmN2E3NGZjMSIsImV4cCI6MTg3OTQ4MjA3NiwiaXNzIjoieXNvdWwiLCJzZWxsZXJJZCI6IjIwMDAyMzQ4ODAiLCJzdG9yZUlkIjoiMTY3MjM2OTcyOTYwNiIsInRpbWVzdGFtcCI6MTc4NDc4NzY3NjY2MSwidmVyc2lvbiI6IlYyIn0.3ZzbGAH4cLU1QR2VPEvMOQInUDvus-C4amkINSQIPuNVlXsFKj0sAt1c0KnUy9MWUOFV9cHlkf7J90r2y1FzpA"
      },
      "example": "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6MCwiYXBwS2V5IjoiNzU2ZjI1NWE2NjdlZTcwNTk1MzM0ZjVjYzk4NzU5MzBmN2E3NGZjMSIsImV4cCI6MTg3OTQ4MjA3NiwiaXNzIjoieXNvdWwiLCJzZWxsZXJJZCI6IjIwMDAyMzQ4ODAiLCJzdG9yZUlkIjoiMTY3MjM2OTcyOTYwNiIsInRpbWVzdGFtcCI6MTc4NDc4NzY3NjY2MSwidmVyc2lvbiI6IlYyIn0.3ZzbGAH4cLU1QR2VPEvMOQInUDvus-C4amkINSQIPuNVlXsFKj0sAt1c0KnUy9MWUOFV9cHlkf7J90r2y1FzpA"
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "name": "body",
          "description": "Body location parameters",
          "type": "object",
          "properties": {
            "storefront_access_token": {
              "name": "storefront_access_token",
              "description": "The access token information. ",
              "type": "object",
              "properties": {
                "title": {
                  "name": "title",
                  "description": "The title of the access token. Used to mark the scenario of the access token.",
                  "type": "string",
                  "example": "For SHOPLINE Themes"
                }
              },
              "example": {
                "title": "For SHOPLINE Themes"
              }
            }
          },
          "example": {
            "storefront_access_token": {
              "title": "For SHOPLINE Themes"
            }
          }
        },
        "examples": {
          "Create an access token for calling Storefront APIs": {
            "description": "Create an access token for calling Storefront APIs",
            "value": {
              "storefront_access_token": {
                "title": "For SHOPLINE Themes"
              }
            }
          }
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "description": "For the complete list of codes and messages, see [Http status code](https://developer.shopline.com/docs/apps/api-instructions-for-use/http-status-code.md?lang=en).",
      "headers": {
        "traceId": {
          "description": "A globally unique identifier for the request. It is used to track the request flow throughout the system, allowing for easy location and debugging when issues arise."
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "name": "body",
            "type": "object",
            "properties": {
              "storefront_access_token": {
                "name": "storefront_access_token",
                "description": "The access token information.",
                "type": "object",
                "properties": {
                  "access_scope": {
                    "name": "access_scope",
                    "description": "Access scopes, defining which APIs the returned access token is allowed to call. Multiple [access scopes](https://developer.shopline.com/docs/apps/api-instructions-for-use/access-scope.md) are separated by `,`.",
                    "type": "string",
                    "example": "unauthenticated_write_message, unauthenticated_read_message"
                  },
                  "access_token": {
                    "name": "access_token",
                    "description": "Access token. This access token must be included in requests when calling Storefront APIs. The system will validate interface request permissions through this access token.\n\n",
                    "type": "string"
                  },
                  "created_at": {
                    "name": "created_at",
                    "description": "The date and time when the access token was created. Format: [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). ",
                    "type": "string"
                  },
                  "id": {
                    "name": "id",
                    "description": "The unique identifier for the access token. ",
                    "type": "string"
                  },
                  "title": {
                    "name": "title",
                    "description": "The title of the access token.",
                    "type": "string"
                  }
                },
                "example": {
                  "access_scope": "unauthenticated_write_message, unauthenticated_read_message",
                  "access_token": null,
                  "created_at": null,
                  "id": null,
                  "title": null
                }
              }
            },
            "example": {
              "storefront_access_token": {
                "access_scope": "unauthenticated_write_message, unauthenticated_read_message",
                "access_token": null,
                "created_at": null,
                "id": null,
                "title": null
              }
            }
          },
          "examples": {
            "Create an access token for calling Storefront APIs": {
              "description": "Create an access token for calling Storefront APIs",
              "value": {
                "storefront_access_token": {
                  "access_scope": "unauthenticated_write_checkouts_info,unauthenticated_read_checkouts_info",
                  "access_token": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ5c291bCIsInRva2VuIjoiZjIzNzlkMjE2MjhjMzNkMTFkYjFmZGI2OTdhM2Y3YzI2ZTRjMGEwOXw2Nzk1MXwxNjcyMzY5NzI5NjA2fDE3NTA5MjEzOTd8MjA2MjIyNjUyMHwifQ.rzFzxg13kFriO3i6HO3n8MbEOIhtILONnE5tULj18pvxp6XSdf38I2vMkDfrEqJS-CdyvSdHcVxIy4TxxyLtMA",
                  "created_at": "2025-06-26T15:03:17+08:00",
                  "id": "2062226520",
                  "title": "For SHOPLINE Themes"
                }
              }
            }
          }
        }
      }
    },
    "401": {
      "headers": {
        "traceId": {
          "description": "A globally unique identifier for the request. It is used to track the request flow throughout the system, allowing for easy location and debugging when issues arise."
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "errors": {
                "description": "Error message. ",
                "type": "string"
              }
            },
            "required": [
              "errors"
            ]
          }
        }
      }
    },
    "429": {
      "headers": {
        "traceId": {
          "description": "A globally unique identifier for the request. It is used to track the request flow throughout the system, allowing for easy location and debugging when issues arise."
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "errors": {
                "description": "Error message. ",
                "type": "string"
              }
            },
            "required": [
              "errors"
            ]
          }
        }
      }
    }
  },
  "security": [
    {
      "oauth2": []
    }
  ],
  "method": "post",
  "path": "/storefront_access_tokens.json",
  "servers": [
    {
      "url": "https://{handle}.myshopline.com/admin/openapi",
      "variables": {
        "handle": {
          "default": "openapiceshidianpu",
          "description": "`handle` : The store's unique identifier, which is the prefix of the store's domain name. For example, if a store's domain name is `open001.myshopline.com` , the store handle is `open001` ."
        }
      }
    }
  ],
  "info": {
    "title": "Create an access token ",
    "version": "v20270301"
  }
}
```