Amazon API Gateway REST API Reference

usageplan:create

Creates a usage plan.

HTTP Request

POST /usageplans

Request Body

{
  "name" : "String",
  "description" : "String",
  "apiStages" : [ {
    "apiId" : "String",
    "stage" : "String"
  } ],
  "throttle" : {
    "burstLimit" : "Integer",
    "rateLimit" : "Double"
  },
  "quota" : {
    "limit" : "Integer",
    "offset" : "Integer",
    "period" : "String"
  }
}

Request Body Fields

The request accepts the following fields in JSON format.

  • name
  • The name of the usage plan.

  • description
  • The description of the usage plan.

  • apiStages
  • The associated API stages of the usage plan.

    • apiId
    • API Id of the associated API stage in a usage plan.

    • stage
    • API stage name of the associated API stage in a usage plan.

  • throttle
  • The throttling limits of the usage plan.

    • burstLimit
    • The API request burst limit, the maximum rate limit over a time ranging from one to a few seconds, depending upon whether the underlying token bucket is at its full capacity.

    • rateLimit
    • The API request steady-state rate limit.

  • quota
  • The quota of the usage plan.

    • limit
    • The maximum number of requests that can be made in a given time period.

    • offset
    • The number of requests subtracted from the given limit in the initial time period.

    • period
    • The time period in which the limit applies. Valid values are "DAY", "WEEK" or "MONTH".

Response

UsagePlan

Remarks

Example

Request
POST /usageplans HTTP/1.1
Content-Type: application/json
Host: apigateway.us-east-1.amazonaws.com
X-Amz-Date: 20160805T013511Z
Authorization: AWS4-HMAC-SHA256 Credential={access_key_ID}/20160805/us-east-1/apigateway/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date, Signature={sigv4_hash}
Cache-Control: no-cache
Postman-Token: c3ffa588-50e0-aa0c-234e-f191671564a9

{
  "name": "Plan_G",
  "description": "my plan",
  "apiStages": [ {
    "stage": "testStage",
    "apiId": "kdwpu39c2k"
  }],
  "quota": {
    "period": "DAY",
    "offset": 0,
    "limit": 500
  },
  "throttle": {
    "rateLimit": 100,
    "burstLimit": 200
  }
}
Response
{
  "_links": {
    "curies": [
      {
        "href": "http://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-usage-{rel}.html",
        "name": "usage",
        "templated": true
      },
      {
        "href": "http://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-usageplan-{rel}.html",
        "name": "usageplan",
        "templated": true
      },
      {
        "href": "http://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-usageplankey-{rel}.html",
        "name": "usageplankey",
        "templated": true
      }
    ],
    "self": {
      "href": "/usageplans/1puccm"
    },
    "usage:get": {
      "href": "/usageplans/1puccm/usage?startDate=2016-07-06&endDate=2016-08-05"
    },
    "usageplan:delete": {
      "href": "/usageplans/1puccm"
    },
    "usageplan:update": {
      "href": "/usageplans/1puccm"
    },
    "usageplan:usageplankeys": {
      "href": "/usageplans/1puccm/keys"
    },
    "usageplankey:create": {
      "href": "/usageplans/1puccm/keys"
    }
  },
  "apiStages": {
    "stage": "testStage",
    "apiId": "kdwpu39c2k"
  },
  "description": "my plan",
  "id": "1puccm",
  "name": "Plan_G",
  "quota": {
    "period": "DAY",
    "offset": 0,
    "limit": 500
  },
  "throttle": {
    "rateLimit": 100,
    "burstLimit": 200
  }
}

See Also

Create and Use Usage Plans