Amazon API Gateway REST API Reference


Creates a new BasePathMapping resource.

HTTP Request

POST /domainnames/<domain_name>/basepathmappings

Request Body

  "basePath" : "String",
  "restApiId" : "String",
  "stage" : "String"

Request Body Fields

The request accepts the following fields in JSON format.

  • basePath
  • The base path name that callers of the API must provide as part of the URL after the domain name. This value must be unique for all of the mappings across a single API. Specify '(none)' if you do not want callers to specify a base path name after the domain name.

  • restApiId
  • [Required] The string identifier of the associated RestApi.

  • stage
  • The name of the API's stage that you want to use for this mapping. Specify '(none)' if you want callers to explicitly specify the stage name after any base path name.




To create an empty base path mapping, set the JSON "basepath" property to an empty string, "".

Example: Creates base path mapping for an API


The following example request creates a TestApi base path that is mapped the fugvjdxtri API in the stage1 stage.

POST /domainnames/ HTTP/1.1
Content-Type: application/json
X-Amz-Date: 20160615T012033Z
Authorization: AWS4-HMAC-SHA256 Credential={access_key_ID}/20160615/us-east-1/apigateway/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date, Signature={sig4_hash}

  "basepath" : "TestApi",
  "restApiId" : "fugvjdxtri",
  "stage" : "stage1"

The successful response returns a 201 Created status code and a payload similar to the following:

  "_links": {
    "curies": {
      "href": "{rel}.html&quot;,
      "name": "basepathmapping",
      "templated": true
    "self": {
      "href": "/domainnames/"
    "basepathmapping:create": {
      "href": "/domainnames/"
    "basepathmapping:delete": {
      "href": "/domainnames/"
    "basepathmapping:update": {
      "href": "/domainnames/"
  "basepath": "TestApi",
  "restApiId": "fugvjdxtri",
  "stage": "stage1"

The API can now be accessed using, in addition to the original invocation URL:

See Also