---
updatedAt: 2026-06-26T19:12:57.000Z
agentTools:
  siteIndex: https://techdocs.akamai.com/llms.txt
  projectIndex: https://techdocs.akamai.com/terraform/llms.txt
---

# API

Get your registered API.

```json Query
data "akamai_apidefinitions_api" "my_api" {
  id = 123456
}

output "my_api" {
  value = data.akamai_apidefinitions_api.my_api
}
```
```json Output
my_api = {
  api    = jsonencode(
    {
      basePath   = "/api"
      constraints  = {
        enforceOn   = {
          request     = true
          undefinedParameters = {
            requestBody    = true
            requestCookie  = true
            requestHeader  = true
            requestQuery   = true
            responseBody   = true
            responseHeader = true
          }
        }
        requestBody = {
          consumeType = [
            "any",
          ]
        }
      }
      description  = "Adding test endpoints."
      enableApiGateway = true
      hostnames  = [
       "my-apidefinitions-hostname.net"
      ]
      name     = "my_api"
      resources  = {
        "/tests/{id}"  = {
          get  = {
            parameters = [
              {
                in   = "header"
                name   = "X-Test"
                required = true
                type   = "string"
              },
              {
                in  = "path"
                maxLength = 5
                minLength = 1
                name  = "id"
                required  = true
                type  = "string"
              },
            ]
          }
          name = "movie"
        }
      }
    }
  )
  contract_id  = "C-0N7RAC7"
  group_id     = 12345
  id     = 123456
  latest_version   = 3
  name     = null
  production_version = 2
  staging_version  = 3
}
```

## Arguments

Provide either the ID or name of your API to get its details.

| Argument | Description      |
| -------- | ---------------- |
| `id`     | Your API's ID.   |
| `name`   | Your API's name. |

## Attributes

Returned to you is a jsonencoded `api` object containing your API details and information about its activation status on the networks.

[block:parameters]
{
  "data": {
    "h-0": "Attribute",
    "h-1": "Description",
    "0-0": "`api`",
    "0-1": "The JSON-formatted conversion of your OpenAPI schema returned from the API Definitions data source. Contains:<ul><li class=\"ps-li\"><code>name</code>. Your API's name.</li><li class=\"ps-li\"><code>hostnames</code>. Your API's root path.</li><li class=\"ps-li\"><code>matchCaseSensitive</code>. Values sent have to match the case you provide.</li><li class=\"ps-li\"><code>enableApiGateway</code>. Enablement status of the API Gateway product. Default is true.</li><li class=\"ps-li\"><code>resources</code>. Information about each of your resources.</li><li class=\"ps-li\"><code>basePath</code>. The base path for your resources.</li><li class=\"ps-li\"><code>tags</code>. A list of tags used by the OpenAPI Description with additional metadata.</li><li class=\"ps-li\"><code>description</code>. A human-readable statement about your API.</li><li class=\"ps-li\"><code>matchPathSegmentParameter</code>. Path segment parameters included in match criteria. Defaults is true.</li><li class=\"ps-li\"><code>graphQl</code>. If the API uses GraphQL to provide data.</li><li class=\"ps-li\"><code>securitySchemes</code>. Details about the key with which users access the endpoint.</li><li class=\"ps-li\"><code>constraints</code>. A list of constraints on the API.</li><li class=\"ps-li\"><code>versioning</code>. Information about your API's version.</li></ul>",
    "1-0": "`contract_id`",
    "1-1": "Your contract ID.",
    "2-0": "`group_id`",
    "2-1": "Your group ID.",
    "3-0": "`id`",
    "3-1": "Your API's ID.",
    "4-0": "`latest_version`",
    "4-1": "The version number for the latest created version of your API. This version may or may not be active.",
    "5-0": "`production_version`",
    "5-1": "The version number for the activated API version in the production environment.",
    "6-0": "`staging_version`",
    "6-1": "The version number for the activated API version in the staging environment.",
    "7-0": "`name`",
    "7-1": "Your API's name."
  },
  "cols": 2,
  "rows": 8,
  "align": [
    null,
    null
  ]
}
[/block]

# Sibling pages

* [OpenAPI](https://techdocs.akamai.com/terraform/docs/apidef-ds-openapi.md)
* [Resource operations](https://techdocs.akamai.com/terraform/docs/apidef-ds-resource-operations.md)