Travis CI API

Varies by plan (check documentation)

Overview

Travis CI is one of the original hosted CI services, tightly integrated with GitHub to automatically run test suites on every push or pull request. The API lets you programmatically list repositories, inspect build history, fetch job logs, and trigger or cancel builds. Note that Travis CI's free tier for open-source projects has become limited; most new projects use the paid plan or migrate to GitHub Actions.

💡

Beginner Tip

Get your Travis CI API token from your profile page at travis-ci.com. The base URL for public GitHub repos is `https://api.travis-ci.com` — the old `api.travis-ci.org` endpoint is deprecated and will return errors.

Available Data

repository name and description
star and fork counts
contributor data
issues and pull requests
commit history

Example Response

JSON Response
{
  "full_name": "octocat/Hello-World",
  "description": "My first repository on GitHub!",
  "stargazers_count": 1500,
  "forks_count": 320,
  "language": "JavaScript",
  "open_issues_count": 12,
  "created_at": "2011-01-26T19:01:12Z"
}

Field Reference

id Travis CI internal ID for the repository.
name Repository name (without the owner prefix).
slug Full "owner/repo" identifier used in API paths.
active Whether Travis CI is currently enabled and watching this repository.
default_branch.name The repository's default branch that Travis CI monitors.
last_build.state Status of the most recent build: "passed", "failed", "errored", or "canceled".

Implementation Example

// ⚠️ Note: This URL may be a documentation page. Check official docs for actual API endpoint.
const url = "https://docs.travis-ci.com/api/";
// Replace headers or query params with the values required by this API.
const response = await fetch(url, {
  headers: {
  "X-API-Key": "YOUR_API_KEY"
  }
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

403 Forbidden / Missing valid token Using the old travis-ci.org token or URL instead of the travis-ci.com equivalents.
Log in to travis-ci.com, copy your token from Settings → API Authentication, and use `https://api.travis-ci.com` as the base URL.
404 Not Found for a repository The repository slug format is wrong — it must be `owner%2Frepo` (URL-encoded slash).
URL-encode the slash: use `octocat%2FHello-World` instead of `octocat/Hello-World` in the path.
422 Unprocessable Entity when triggering a build The request body is missing required fields or the branch does not exist on GitHub.
Include `{"request":{"branch":"main"}}` in the POST body and confirm the branch exists in the linked GitHub repository.

Matrix Score Breakdown

🌐 Reachability 30/30
⚡ Speed 5/20
🔒 Security 15/15
🛠 Developer XP 12/20
✓ Reliability 10/15

Partially tested on Apr 5, 2026

Technical Specifications

Auth API Key
HTTPS REQUIRED
CORS UNKNOWN
Difficulty Intermediate
Verified: 2026-04-04

Similar APIs

View All →