Working with the SourceCraft REST API

To set up SourceCraft automation and integration into your projects, use its public REST API.

See the SourceCraft OpenAPI specification.

For API authentication, use your personal access token (PAT), e.g., to get a list of user issues:

export PAT=<personal_access_token>
curl \
  --request GET \
  --header "Authorization: Bearer $PAT" \
  --url "https://api.sourcecraft.tech/me/issues" | jq

Tip

For authenticating with the SourceCraft API from within the CI/CD workflow, use the SOURCECRAFT_TOKEN predefined variable.

Example of .sourcecraft/ci.yaml
on:
  push: test-workflow
workflows:
  test-workflow:
    tasks:
      - name: issues-task
        cubes:
          - name: i-have-got-issues
            script:
              - |
                curl -H "Authorization: Bearer $SOURCECRAFT_TOKEN" "https://api.sourcecraft.tech/me/issues" | jq

See also