Skip to main content Link Menu Expand (external link) Document Search Copy Copied

auth0 apis create

Create a new API.

To create interactively, use auth0 apis create with no flags.

To create non-interactively, supply the name, identifier, scopes, token lifetime and whether to allow offline access through the flags.

Use ‘–schema’ to print the request payload schema and exit. Use ‘–data’ to supply the full JSON payload (validated against the schema before sending).

Usage

auth0 apis create [flags]

Examples

  auth0 apis create
  auth0 apis create --name myapi
  auth0 apis create --name myapi --identifier http://my-api
  auth0 apis create --name myapi --identifier http://my-api --token-lifetime 6100
  auth0 apis create --name myapi --identifier http://my-api --token-lifetime 6100 --offline-access=true
  auth0 apis create --name myapi --identifier http://my-api --token-lifetime 6100 --offline-access=false --scopes "letter:write,letter:read"
  auth0 apis create --name myapi --identifier http://my-api --token-lifetime 6100 --offline-access=false --scopes "letter:write,letter:read" --signing-alg "RS256"
  auth0 apis create -n myapi -i http://my-api -t 6100 -o false -s "letter:write,letter:read" --signing-alg "RS256" --json
  auth0 apis create -n myapi -i http://my-api -t 6100 -o false -s "letter:write,letter:read" --signing-alg "RS256" --json-compact
  auth0 apis create --name myapi --identifier http://my-api --subject-type-authorization '{"user":{"policy":"allow_all"},"client":{"policy":"deny_all"}}'
  auth0 apis create --name myapi --identifier http://my-api --enforce-policies --token-dialect access_token_authz

  # Discover the payload schema
  auth0 apis create --schema
  auth0 apis create --schema --json

  # JSON input mode (for agents and automation)
  auth0 apis create --data '{"name":"myapi","identifier":"https://my-api"}'
  auth0 apis create --data @api.json
  cat api.json | auth0 apis create

Flags

      --data string                         JSON payload for the operation, as a JSON string or file path (@file.json). Can also be piped via stdin.
      --enforce-policies                    If true, authorization policies will be enforced for this API.
  -i, --identifier string                   Identifier of the API. Cannot be changed once set.
      --json                                Output in json format.
      --json-compact                        Output in compact json format.
  -n, --name string                         Name of the API.
  -o, --offline-access                      Whether Refresh Tokens can be issued for this API (true) or not (false).
      --schema                              Print the request payload schema for this command and exit. Use with --json or --json-compact for machine-readable output.
  -s, --scopes strings                      Comma-separated list of scopes (permissions).
      --signing-alg string                  Algorithm used to sign JWTs. Can be HS256 or RS256. PS256 available via addon. (default "RS256")
      --subject-type-authorization string   JSON object defining access policies for user and client flows. Example: '{"user":{"policy":"require_client_grant"},"client":{"policy":"deny_all"}}' (default "{}")
      --token-dialect string                Dialect of access tokens for this API. Can be one of access_token, access_token_authz, rfc9068_profile, or rfc9068_profile_authz.
  -l, --token-lifetime int                  The amount of time in seconds that the token will be valid after being issued. Default value is 86400 seconds (1 day).

Inherited Flags

      --agent-mode      Output JSON, disable prompts and colors. Auto-enabled for AI agents; set AUTH0_AGENT_MODE=false to disable.
      --debug           Enable debug mode.
      --no-color        Disable colors.
      --no-input        Disable interactivity.
      --tenant string   Specific tenant to use.