SpecVault Docs

Other Pipelines

Publishing to SpecVault from Jenkins, Bitbucket Pipelines, CircleCI, or any environment with HTTP access.

The core API call

SpecVault's publish API is a plain HTTP POST. Any tool that can make an authenticated HTTP request can publish a spec. The two supported methods are:

Publish from a URL

SpecVault fetches the spec from your API server at publish time:

curl -sf -X POST \
  "https://specvault.sentinelflux.in/api/services/<service-id>/specs" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"spec_url": "https://api.yourcompany.com/openapi.json"}'

Upload a file

Send the spec file directly as a multipart upload:

curl -sf -X POST \
  "https://specvault.sentinelflux.in/api/services/<service-id>/specs" \
  -H "Authorization: Bearer <token>" \
  -F "file=@openapi.yaml"

Jenkins Pipeline

Add a post-deploy step using the sh step with credentials injected from Jenkins Credentials:

pipeline {
  agent any
  environment {
    SPECVAULT_TOKEN = credentials('specvault-api-token')
  }
  stages {
    stage('Deploy') {
      steps {
        sh './scripts/deploy.sh'
      }
    }
    stage('Publish Spec') {
      steps {
        sh """
          curl -sf -X POST \\
            "https://specvault.sentinelflux.in/api/services/${SPECVAULT_SERVICE_ID}/specs" \\
            -H "Authorization: Bearer ${SPECVAULT_TOKEN}" \\
            -H "Content-Type: application/json" \\
            -d '{"spec_url": "${API_BASE_URL}/openapi.json"}'
        """
      }
    }
  }
}

Bitbucket Pipelines

pipelines:
  branches:
    main:
      - step:
          name: Deploy
          script:
            - ./scripts/deploy.sh
      - step:
          name: Publish spec to SpecVault
          image: alpine/curl
          script:
            - |
              curl -sf -X POST \
                "https://specvault.sentinelflux.in/api/services/${SPECVAULT_SERVICE_ID}/specs" \
                -H "Authorization: Bearer ${SPECVAULT_TOKEN}" \
                -H "Content-Type: application/json" \
                -d "{\"spec_url\": \"${API_BASE_URL}/openapi.json\"}"

CircleCI

version: 2.1
jobs:
  publish-spec:
    docker:
      - image: alpine/curl
    steps:
      - run:
          name: Publish spec to SpecVault
          command: |
            curl -sf -X POST \
              "https://specvault.sentinelflux.in/api/services/${SPECVAULT_SERVICE_ID}/specs" \
              -H "Authorization: Bearer ${SPECVAULT_TOKEN}" \
              -H "Content-Type: application/json" \
              -d "{\"spec_url\": \"${API_BASE_URL}/openapi.json\"}"

workflows:
  deploy:
    jobs:
      - publish-spec:
          filters:
            branches:
              only: main

Python / requests

If you prefer Python over curl in your pipeline scripts:

import os
import requests

token = os.environ["SPECVAULT_TOKEN"]
service_id = os.environ["SPECVAULT_SERVICE_ID"]

resp = requests.post(
    f"https://specvault.sentinelflux.in/api/services/{service_id}/specs",
    headers={"Authorization": f"Bearer {token}"},
    json={"spec_url": "https://api.yourcompany.com/openapi.json"},
    timeout=30,
)
resp.raise_for_status()
print("Spec published:", resp.json())

The publish endpoint returns the new version number and breaking change count in the response body, which you can log or use to fail the pipeline step if breaking changes are found.