Working with the SourceCraft REST API

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

For details, refer to the SourceCraft OpenAPI guides.

You can also view the SourceCraft OpenAPI specification in JSON format.

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 \
                  --header "Authorization: Bearer $SOURCECRAFT_TOKEN" \
                  --url "https://api.sourcecraft.tech/me/issues"

Examples

See also