owasp-amass/amass · error
no API key found
Error message
no API key found
What it means
GetAPI in engine/plugins/support/support.go returns errors.New("no API key found") when the data source named by the first argument has no configuration entry (GetDataSourceConfig returns nil) or its config contains zero credentials. The library requires an API key to use the corresponding data-source plugin and refuses to proceed without one.
Source
Thrown at engine/plugins/support/support.go:118
now := time.Now()
if matches, err := c.CheckTransformations(from, to, plugin); err == nil && matches != nil {
if ttl := matches.TTL(plugin); ttl >= 0 {
return now.Add(time.Duration(-ttl) * time.Minute), nil
}
if ttl := matches.TTL(to); ttl >= 0 {
return now.Add(time.Duration(-ttl) * time.Minute), nil
}
}
return time.Time{}, fmt.Errorf("failed to obtain the TTL for transformation %s->%s", from, to)
}
func GetAPI(name string, e *et.Event) (string, error) {
// TODO: Add support for multiple API keys
dsc := e.Session.Config().GetDataSourceConfig(name)
if dsc == nil || len(dsc.Creds) == 0 {
return "", errors.New("no API key found")
}
for _, cred := range dsc.Creds {
if cred != nil && cred.Apikey != "" {
return cred.Apikey, nil
}
}
return "", errors.New("no API key found")
}
func IPNetblock(session et.Session, addrstr string) *sessions.CIDRangerEntry {
ip := net.ParseIP(addrstr)
if ip == nil {
return nil
}
entries, err := session.CIDRanger().ContainingNetworks(ip)View on GitHub (pinned to 79299dce87)
Solutions
- Add the data source configuration with at least one credential entry (with apikey) to the session config.
- Verify the data source name passed to GetAPI matches the name used in the config file.
- Confirm the config file is actually loaded by the session before enumeration starts.
- Obtain a valid API key from the provider and place it under the source's creds.apikey field.
Example fix
// before (config)
// (no entry for the source)
// after (YAML config)
data_sources:
bgptools:
creds:
- apikey: "YOUR_API_KEY" Defensive patterns
Strategy: validation
Validate before calling
// Go: verify the source is configured before calling GetAPI
dsc := session.Config().GetDataSourceConfig("bgptools")
if dsc == nil || len(dsc.Creds) == 0 {
log.Fatal("configure credentials for bgptools before running")
} Type guard
func hasAPIKey(session et.Session, name string) bool {
dsc := session.Config().GetDataSourceConfig(name)
return dsc != nil && len(dsc.Creds) > 0
} Try / catch
key, err := support.GetAPI("bgptools", event)
if err != nil {
log.Warn("source disabled: ", err.Error())
return nil // skip this data source
} Prevention
- Declare all required API keys in the config file before scanning.
- Keep data source names in config identical to plugin names.
- Load apikeys from environment variables and fail fast when unset.
- Document which data sources are mandatory vs optional.
When it happens
Trigger: Calling support.GetAPI(name, event) where e.Session.Config().GetDataSourceConfig(name) returns nil (source not configured) or dsc.Creds is empty — i.e. the plugin's data source was never given credentials in the config.
Common situations: Running the tool without a config file specifying API keys for paid data sources; config key name mismatch (source configured under a different name than the plugin expects); credentials present but not loaded from the environment/file.
Understand the failure class
Background: "API key is required" / "API key not found" / "No API key was set": the missing-api-key error family across 16 libraries — this error's family across 16 libraries.
Related errors
- no resolver keys were found in the resolvers section
- brute forcing cannot be performed without DNS resolution
- active enumeration cannot be performed without DNS resolutio
- resolvers section is not a list
- no valid resolvers were found
AI-assisted analysis of owasp-amass/amass@79299dce87 (2026-09-06).
Data as JSON: /api/errors/3a1a674133444dcc.
Report an issue: GitHub.