For the complete documentation index, see llms.txt. This page is also available as Markdown.

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

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.

  1. Go to Manage Jenkins > Credentials, pick a scope (e.g. (global))

  2. Add Credentials > Kind: Secret text

  3. 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

  1. Trigger a build of the pipeline

  2. Check the Jenkins console output for the Run Akto Security Test stage — it should print the Akto scan output

  3. If vulnerabilities at or above BLOCK_LEVEL are found, the stage fails the build with Block level breached

  4. Open the Akto dashboard to view full test results

Never commit the Akto API key directly in your Jenkinsfile. Always read it from a Jenkins credential via withCredentials, as shown above.

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 run

  • AKTO_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 to 0 to 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, or NONE to never block)

  • CICD_PLATFORM — set to Jenkins so 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