# sourceWebhooks

```graphql
query SourceWebhooks($projectReference: ID!) {
  sourceWebhooks(projectReference: $projectReference) {
    data {
      id
      sourceTriggerId
      name
      description
      promptTemplate
      eventFilter
      definitionSource
      sourcePath
      sourceHash
      editMode
    }
    diagnostics {
      kind
      sourceKind
      sourcePath
      sourceId
      code
      message
      details
    }
    errors {
      kind
      sourceKind
      sourcePath
      sourceId
      code
      message
      details
    }
  }
}
```

List the webhooks declared in the source files of a project, a branch or an environment to see what a deployment creates; returns the declared webhooks, the discovery diagnostics and the source files that could not be read, without pagination. Requires project.agents.read.

## Arguments

| Name                        | Type                     | Required | Description                                                                                                                    |
| --------------------------- | ------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------ |
| `projectReference`          | ID!                      | Yes      | Project UUID or slug.                                                                                                          |
| `input`                     | SourceWebhooksInput      |          |                                                                                                                                |
| `input.sourceTargetKind`    | WebhookSourceTargetKind  |          | The source to read; default runtimeTargetKind, else project. One of `project`, `main_branch`, `environment`, `preview_branch`. |
| `input.runtimeTargetKind`   | WebhookRuntimeTargetKind |          | One of `main_branch`, `environment`, `preview_branch`.                                                                         |
| `input.targetEnvironmentId` | ID                       |          | Required with runtimeTargetKind environment.                                                                                   |
| `input.targetBranchId`      | ID                       |          | Required with runtimeTargetKind preview\_branch.                                                                               |

## Variables

```json
{
  "projectReference": "string"
}
```

## Responses

| Status | Description                                    |
| ------ | ---------------------------------------------- |
| 200    | The SourceWebhookList! in data.sourceWebhooks. |

## Call it

```bash
curl -X POST "https://api.veryfront.com/graphql" \
  -H "Authorization: Bearer $VERYFRONT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "query": "query SourceWebhooks($projectReference: ID!) {\n  sourceWebhooks(projectReference: $projectReference) {\n    data {\n      id\n      sourceTriggerId\n      name\n      description\n      promptTemplate\n      eventFilter\n      definitionSource\n      sourcePath\n      sourceHash\n      editMode\n    }\n    diagnostics {\n      kind\n      sourceKind\n      sourcePath\n      sourceId\n      code\n      message\n      details\n    }\n    errors {\n      kind\n      sourceKind\n      sourcePath\n      sourceId\n      code\n      message\n      details\n    }\n  }\n}",
  "variables": {
    "projectReference": "string"
  }
}'
```

## Example response

```json
{
  "data": {
    "sourceWebhooks": {
      "data": [
        {
          "id": "string",
          "sourceTriggerId": "string",
          "name": "string",
          "description": "string",
          "promptTemplate": "string",
          "eventFilter": {},
          "definitionSource": "manual",
          "sourcePath": "string",
          "sourceHash": "string",
          "editMode": "structured"
        }
      ],
      "diagnostics": [
        {
          "kind": "string",
          "sourceKind": "string",
          "sourcePath": "string",
          "sourceId": "string",
          "code": "string",
          "message": "string",
          "details": {}
        }
      ],
      "errors": [
        {
          "kind": "string",
          "sourceKind": "string",
          "sourcePath": "string",
          "sourceId": "string",
          "code": "string",
          "message": "string",
          "details": {}
        }
      ]
    }
  }
}
```
