---
metadata:
  - name: generator
    content: Diplodoc Platform v5.54.2
alternate:
  - https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/api-start.md
  - https://sourcecraft.dev/portal/docs/ru/sourcecraft/operations/api-start.md
  - href: en/sourcecraft/operations/api-start.md
    type: text/markdown
    title: Markdown version
  - href: ../../llms.txt
    type: text/markdown
    title: llms.txt
---
> **Documentation Index:** Fetch the complete configuration index at https://sourcecraft.dev/portal/docs/en/llms.txt

# Working with the SourceCraft REST API

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

The following computing API documentation resources are available:
* [Method descriptions](https://sourcecraft.dev/portal/docs/en/api-ref/index.md)
* [Interactive reference](https://api.sourcecraft.tech/docs/index.html)
* [JSON specification](https://api.sourcecraft.tech/sourcecraft.swagger.json)

For API authentication, use your [personal access token (PAT)](https://sourcecraft.dev/portal/docs/en/sourcecraft/security/pat.md), e.g., to get a list of user [issues](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/index.md#issues):

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

<!-- source: en/_includes/sourcecraft/ci-cd/ci-cd-api-auth-tip.md -->
{% note tip %}

For authenticating with the SourceCraft API from within the [CI/CD](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/ci-cd.md) workflow, use the `SOURCECRAFT_TOKEN` [predefined variable](https://sourcecraft.dev/portal/docs/en/sourcecraft/ci-cd-ref/predefined-variables.md).

{% cut "Example of .sourcecraft/ci.yaml" %}

<!-- source: en/_includes/sourcecraft/ci-cd/src-token-example.md -->
```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"
```
<!-- endsource: en/_includes/sourcecraft/ci-cd/src-token-example.md -->

{% endcut %}

{% endnote %}
<!-- endsource: en/_includes/sourcecraft/ci-cd/ci-cd-api-auth-tip.md -->

### Examples {#examples}

* [Working with invitations via the API](https://sourcecraft.dev/portal/docs/en/sourcecraft/security/invite.md#api)
* [Assigning a role in a repository to a user via the API](https://sourcecraft.dev/portal/docs/en/sourcecraft/security/bind.md#api)

#### Useful links {#see-also}

* [Method descriptions](https://sourcecraft.dev/portal/docs/en/api-ref/index.md)
* [Interactive reference](https://api.sourcecraft.tech/docs/index.html)
* [JSON specification](https://api.sourcecraft.tech/sourcecraft.swagger.json)
* [Getting started with the SourceCraft CLI](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/cli-quickstart.md)
* [SourceCraft resource relationships](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/index.md)
* [Access management in SourceCraft](https://sourcecraft.dev/portal/docs/en/sourcecraft/security/index.md)
* 