v51
latestOpenAPI 3.0.3Mozilla Public License Version 2.0raw.githubusercontent.com2026-08-0165205256.0 KBAPIs
Create an API
Create API. A single Tyk node can have its API Definitions queried, deleted and updated remotely. This functionality enables you to remotely update your Tyk definitions without having to manage the files manually.
post/tyk/apis
Query parameters
base_api_idstring
The base API which the new version will be linked to.
base_api_version_namestring
The version name of the base API while creating the first version. This doesn't have to be sent for the next versions but if it is set, it will override base API version name.
new_version_namestring
The version name of the created version.
set_defaultboolean
If true, the new version is set as default version.
Request body
Example request
{
"CORS": {
"allowed_headers": [
"Origin",
"Accept",
"Content-Type",
"Authorization"
],
"allowed_methods": [
"GET",
"HEAD",
"POST"
],
"allowed_origins": [
"https://*.foo.com"
],
"debug": true,
"exposed_headers": [
"Accept",
"Content-Type"
],
"max_age": 24
},
"auth": {
"auth_header_name": "Authorization"
},
"cache_options": {
"cache_timeout": 60,
"enable_cache": true
},
"custom_middleware": {
"auth_check": {
"name": "PreMiddlewareFunction"
},
"post": [
{
"name": "PreMiddlewareFunction"
}
],
"post_key_auth": [
{
"name": "PreMiddlewareFunction"
}
],
"pre": [
{
"name": "PreMiddlewareFunction"
}
],
"response": [
{
"name": "PreMiddlewareFunction"
}
]
},
"definition": {
"key": "x-api-version",
"location": "header"
},
"proxy": {
"listen_path": "/relative-path-examples/",
"strip_listen_path": true,
"target_url": "https://httpbin.org/"
},
"tags": [
"Default",
"v1"
]
}Response
API created.
Example response
{
"action": "modified",
"key": "b13d928b9972bd18",
"status": "ok"
}