2020-10-24 23:57:45 +05:30
---
stage: Verify
group: Continuous Integration
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
2019-12-04 20:38:33 +05:30
# Validate the `.gitlab-ci.yml` (API)
2016-09-29 09:46:39 +05:30
2020-05-24 23:13:21 +05:30
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/5953) in GitLab 8.12.
2016-09-29 09:46:39 +05:30
2019-07-07 11:18:12 +05:30
Checks if your `.gitlab-ci.yml` file is valid.
2016-09-29 09:46:39 +05:30
2020-04-08 14:13:33 +05:30
```plaintext
2019-10-12 21:52:04 +05:30
POST /ci/lint
2016-09-29 09:46:39 +05:30
```
| Attribute | Type | Required | Description |
| ---------- | ------- | -------- | -------- |
2019-12-04 20:38:33 +05:30
| `content` | string | yes | the `.gitlab-ci.yaml` content|
2016-09-29 09:46:39 +05:30
2020-03-13 15:44:24 +05:30
```shell
2020-06-23 00:09:42 +05:30
curl --header "Content-Type: application/json" "https://gitlab.example.com/api/v4/ci/lint" --data '{"content": "{ \"image\": \"ruby:2.6\", \"services\": [\"postgres\"], \"before_script\": [\"bundle install\", \"bundle exec rake db:create\"], \"variables\": {\"DB_NAME\": \"postgres\"}, \"types\": [\"test\", \"deploy\", \"notify\"], \"rspec\": { \"script\": \"rake spec\", \"tags\": [\"ruby\", \"postgres\"], \"only\": [\"branches\"]}}"}'
2016-09-29 09:46:39 +05:30
```
Be sure to copy paste the exact contents of `.gitlab-ci.yml` as YAML is very picky about indentation and spaces.
Example responses:
2019-03-02 22:35:43 +05:30
- Valid content:
2016-09-29 09:46:39 +05:30
2019-09-30 21:07:59 +05:30
```json
{
"status": "valid",
"errors": []
}
```
2016-09-29 09:46:39 +05:30
2019-03-02 22:35:43 +05:30
- Invalid content:
2016-09-29 09:46:39 +05:30
2019-09-30 21:07:59 +05:30
```json
{
"status": "invalid",
"errors": [
"variables config should be a hash of key value pairs"
]
}
```
2016-09-29 09:46:39 +05:30
2019-03-02 22:35:43 +05:30
- Without the content attribute:
2016-09-29 09:46:39 +05:30
2019-09-30 21:07:59 +05:30
```json
{
"error": "content is missing"
}
```