Jenkins
Akto integrates with Jenkins to add automated API security testing to your build pipeline. This integration enables you to:
Run API security tests during your Jenkins builds
Automate security testing for each deployment
View security test results in Jenkins interface

This page shows how to add an Akto security test as a stage in a new or existing Jenkinsfile — it does not cover setting up a Jenkins pipeline from scratch.
Prerequisites
A working Jenkins pipeline (declarative
Jenkinsfile) that you can add a stage toJenkins agent with Docker available (the Akto scan runs via the
aktosecurity/akto-testing-scanDocker image)Akto API credentials (API key and dashboard URL)
Either a valid test ID from an existing Akto test, or the name of an API collection and test suite you want to run (see Option 2 below)
Step 1: Store the Akto API key as a Jenkins credential
Don't hardcode AKTO_API_KEY in the Jenkinsfile — store it in Jenkins' credential manager so it's masked in logs and never committed to source control.
Go to Manage Jenkins > Credentials, pick a scope (e.g.
(global))Add Credentials > Kind: Secret text
Paste your Akto API key as the secret, and set the ID to
akto-api-key
Step 2: Add the Akto stage to your Jenkinsfile
Add a stage that pulls the credential with withCredentials and runs the Akto scan container. Pick whichever option matches how you want to trigger the test.
Option 1: Run an existing test (AKTO_TEST_ID)
Use this when you already have a configured test run in the Akto dashboard and just want CI/CD to re-trigger it (see how to get the test ID). This adds the stage as its own pipeline step, calling a separate runAktoTest function that wraps the docker run call:
AKTO_API_KEY is pulled from the Jenkins credential via withCredentials; AKTO_TEST_ID sits directly in the environment {} block since a test ID isn't sensitive. IS_COMMIT_TRUNK gates the stage so it only runs on trunk builds; drop the when block if you want it to run on every build.
Option 2: Run a test suite on an API collection
Use this when you don't want to pre-create a test in the dashboard — instead give Akto an API collection name and a test suite name, and it starts a new run against that collection. Both names must match exactly what's in the dashboard (collections, under API Discovery > Collections; test suites, under API Security Testing > Test suites — this includes both default/OWASP suites and custom ones you've created).
Step 3: Verify the integration
Trigger a build of the pipeline
Check the Jenkins console output for the
Run Akto Security Teststage — it should print the Akto scan outputIf vulnerabilities at or above
BLOCK_LEVELare found, the stage fails the build withBlock level breachedOpen the Akto dashboard to view full test results
Available environment variables
The same configuration options available in other CI/CD integrations apply here (passed as -e flags to the Docker container):
AKTO_DASHBOARD_URL,AKTO_API_KEY— required on every runAKTO_TEST_ID— reuse an existing test run (Option 1)API_GROUP_NAME,TEST_SUITE_NAME— start a new run against a collection and test suite (Option 2)WAIT_TIME_FOR_RESULT— seconds to wait for results before the stage completes (set to0to fire-and-forget without blocking the build)BLOCK_LEVEL— fail the build if issues at or above this severity are found (CRITICAL,HIGH,MEDIUM,LOW, orNONEto never block)CICD_PLATFORM— set toJenkinsso results show the correct origin in the Akto dashboard
For the full list of supported options (scheduling, Slack/MS Teams alerts, Jira auto-ticketing, advanced request overrides), see the akto-api-security/run-scan README.
Last updated