---
updatedAt: 2026-04-20T19:22:01.000Z
---

# Get an authorization code

Returns an authorization code you can exchange for an access token and a refresh token.

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "Authentication",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://{hostname}"
    }
  ],
  "paths": {
    "/access/getAuthorizationCode": {
      "post": {
        "operationId": "post-authorization-code",
        "summary": "Get an authorization code",
        "description": "Returns an authorization code you can exchange for an access token and a refresh token.",
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "properties": {
                  "for_client_id": {
                    "type": "string",
                    "description": "Unique identifier of the API client\n",
                    "example": "0987fghi0987fghi"
                  },
                  "id": {
                    "type": "integer",
                    "description": "Unique identifier of the user logging in. Required unless you use the `uuid` or `key_attribute` parameter.\n",
                    "example": 999
                  },
                  "key_attribute": {
                    "type": "string",
                    "description": "Name of a unique attribute in the schema. Required unless you use the `id` or `uuid` member. If you use `key_attribute`, your operation needs to include the `key_value` member as well.\n",
                    "example": "email"
                  },
                  "key_value": {
                    "type": "string",
                    "description": "Value for the attribute specified by the `key_attribute` parameter. String values are enclosed in quotes.\n",
                    "example": 12190603
                  },
                  "lifetime": {
                    "type": "string",
                    "description": "Number of seconds for which the authorization code is valid.\n",
                    "default": 30,
                    "example": 45
                  },
                  "redirect_uri": {
                    "type": "string",
                    "description": "Either the redirect URL used to obtain an authorization code or the `redirectUri` setting configured in a JavaScript SDK-based implementation. Required only when the `grant_type` is set to `authorization_code`\n",
                    "example": "http://documentation.janraincapture.com/oauth"
                  },
                  "transaction_state": {
                    "type": "string",
                    "description": "JSON string associated with the authorization code and returned when that code is exchanged for an access token and a refresh token.\n",
                    "example": {
                      "transaction_state": {
                        "capture": {
                          "action": "signin"
                        }
                      }
                    }
                  },
                  "type_name": {
                    "type": "string",
                    "description": "Name of the user profile database where the user’s user profile is stored\n",
                    "example": "user"
                  },
                  "uuid": {
                    "type": "string",
                    "description": "Unique identifier for the user logging in. Required unless you're using the `id` or `key_attribute` parameters to identify the user record.\n",
                    "example": "bc90747f-ebc0-4fc2-8f38-c393d64a8248"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "authorizationCode": "12345678912345",
                  "stat": "ok"
                },
                "schema": {
                  "type": "object",
                  "description": "Returns an authorization code. Authorization codes can be exchanged for an access token and a refresh token.\n",
                  "required": [
                    "authorizationCode",
                    "stat"
                  ],
                  "properties": {
                    "authorizationCode": {
                      "description": "Unique identifier of the returned authorization code.\n",
                      "example": null,
                      "nullable": true,
                      "type": "string"
                    },
                    "stat": {
                      "description": "Indicates the status of the current operation.\n",
                      "enum": [
                        "ok",
                        "fail",
                        "error"
                      ],
                      "example": null,
                      "nullable": true,
                      "type": "string"
                    }
                  }
                }
              }
            },
            "description": "Successful response\n"
          }
        }
      }
    }
  },
  "x-readme": {
    "samples-languages": [
      "curl",
      "python",
      "node"
    ],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "externalDocs": {
    "url": "https://techdocs.akamai.com/identity-cloud-auth/reference",
    "description": "See documention for Akamai's Identity Cloud: Authentication API\n"
  }
}
```