Docs Navigation

Api v2 Secrets

Stability: prototype

  1. List secrets in an organization
  2. List secrets in a team
  3. List secrets attached to a project
  4. Get a secret
  5. Create secret in an organization
  6. Update a secret
  7. Delete a secret
  8. Add a secret to a team
  9. Attach a secret to a project
  10. Remove secret from a team
  11. Dettach a secret from a project

# List secrets in an organization

GET /orgs/{org_username}/secrets
# Response
HTTP status: 200

[
  {
    "name": "AWS Tokens",
    "description": "AWS tokens for deployment",
    "id": "86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5",
    "url": "https://api.semaphoreci.com/v2/secrets/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5",
    "projects_url": "https://api.semaphoreci.com/v2/secrets/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5/projects",
    "teams_url": "https://api.semaphoreci.com/v2/secrets/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5/teams",
    "env_vars_url": "https://api.semaphoreci.com/v2/secrets/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5/env_vars",
    "config_files_url": "https://api.semaphoreci.com/v2/secrets/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5/config_files",
    "created_at": "2017-06-10 16:59:51 +0200",
    "updated_at": "2017-06-10 16:59:51 +0200"
  }
]

# List secrets in a team

GET /teams/{team_id}/secrets
# Response
HTTP status: 200

[
  {
    "name": "AWS Tokens",
    "description": "AWS tokens for deployment",
    "id": "86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5",
    "url": "https://api.semaphoreci.com/v2/secrets/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5",
    "projects_url": "https://api.semaphoreci.com/v2/secrets/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5/projects",
    "teams_url": "https://api.semaphoreci.com/v2/secrets/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5/teams",
    "env_vars_url": "https://api.semaphoreci.com/v2/secrets/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5/env_vars",
    "config_files_url": "https://api.semaphoreci.com/v2/secrets/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5/config_files",
    "created_at": "2017-06-10 16:59:51 +0200",
    "updated_at": "2017-06-10 16:59:51 +0200"
  }
]

# List secrets attached to a project

GET /projects/{project_id}/secrets
# Response
HTTP status: 200

[
  {
    "name": "AWS Tokens",
    "description": "AWS tokens for deployment",
    "id": "86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5",
    "url": "https://api.semaphoreci.com/v2/secrets/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5",
    "projects_url": "https://api.semaphoreci.com/v2/secrets/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5/projects",
    "teams_url": "https://api.semaphoreci.com/v2/secrets/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5/teams",
    "env_vars_url": "https://api.semaphoreci.com/v2/secrets/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5/env_vars",
    "config_files_url": "https://api.semaphoreci.com/v2/secrets/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5/config_files",
    "created_at": "2017-06-10 16:59:51 +0200",
    "updated_at": "2017-06-10 16:59:51 +0200"
  }
]

# Get a secret

GET /secrets/{id}
# Response
HTTP status: 200

{
  "name": "AWS Tokens",
  "description": "AWS tokens for deployment",
  "id": "86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5",
  "url": "https://api.semaphoreci.com/v2/secrets/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5",
  "projects_url": "https://api.semaphoreci.com/v2/secrets/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5/projects",
  "teams_url": "https://api.semaphoreci.com/v2/secrets/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5/teams",
  "env_vars_url": "https://api.semaphoreci.com/v2/secrets/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5/env_vars",
  "config_files_url": "https://api.semaphoreci.com/v2/secrets/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5/config_files",
  "created_at": "2017-06-10 16:59:51 +0200",
  "updated_at": "2017-06-10 16:59:51 +0200"
}

# Create secret in an organization

POST /orgs/{org_username}/secrets
# Request
Name Type Description
name string Required. Name of the secret.
description string Description for the secret.
# Response
HTTP status: 200

{
  "name": "AWS Tokens",
  "description": "AWS tokens for deployment",
  "id": "86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5",
  "url": "https://api.semaphoreci.com/v2/secrets/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5",
  "projects_url": "https://api.semaphoreci.com/v2/secrets/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5/projects",
  "teams_url": "https://api.semaphoreci.com/v2/secrets/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5/teams",
  "env_vars_url": "https://api.semaphoreci.com/v2/secrets/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5/env_vars",
  "config_files_url": "https://api.semaphoreci.com/v2/secrets/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5/config_files",
  "created_at": "2017-06-10 16:59:51 +0200",
  "updated_at": "2017-06-10 16:59:51 +0200"
}

# Update a secret

To update the secret you need to be an admin or owner in your organization.

PATCH /secrets/{id}
# Request
Name Type Description
name string Name of the secret.
description string Description for the secrets.
# Response
HTTP status: 200

{
  "name": "AWS Tokens",
  "description": "AWS tokens for deployment",
  "id": "86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5",
  "url": "https://api.semaphoreci.com/v2/secrets/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5",
  "projects_url": "https://api.semaphoreci.com/v2/secrets/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5/projects",
  "teams_url": "https://api.semaphoreci.com/v2/secrets/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5/teams",
  "env_vars_url": "https://api.semaphoreci.com/v2/secrets/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5/env_vars",
  "config_files_url": "https://api.semaphoreci.com/v2/secrets/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5/config_files",
  "created_at": "2017-06-10 16:59:51 +0200",
  "updated_at": "2017-06-10 16:59:51 +0200"
}

# Delete a secret

Deleting secret will remove it from all projects it is used on. Deleting a secret requires at least admin permissions in the organization.

DELETE /secrets/{id}
# Response
HTTP status: 204

# Add a secret to a team

The user needs to be a member of the team, and to have admin permissions in the organization.

POST /teams/{team_id}/secrets/{secret_id}
# Response
HTTP status: 204

# Attach a secret to a project

POST /projects/{project_id}/secrets/{secret_id}
# Response
HTTP status: 200

{
  "name": "AWS Tokens",
  "description": "AWS tokens for deployment",
  "id": "86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5",
  "url": "https://api.semaphoreci.com/v2/secrets/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5",
  "projects_url": "https://api.semaphoreci.com/v2/secrets/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5/projects",
  "teams_url": "https://api.semaphoreci.com/v2/secrets/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5/teams",
  "env_vars_url": "https://api.semaphoreci.com/v2/secrets/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5/env_vars",
  "config_files_url": "https://api.semaphoreci.com/v2/secrets/86e78b7e-2f9c-45a7-9939-ec2c9f6f64b5/config_files",
  "created_at": "2017-06-10 16:59:51 +0200",
  "updated_at": "2017-06-10 16:59:51 +0200"
}

# Remove secret from a team

The user needs to be a member of the team, and to have admin permissions in the organization.

DELETE /teams/{team_id}/secrets/{secret_id}
# Response
HTTP status: 204

# Dettach a secret from a project

DELETE /projects/{project_id}/secrets/{secret_id}
# Response
HTTP status: 204

Semaphore Docs are open source — Edit on GitHub

Newsletter

Occasional lightweight product and blog updates. Unsubscribe at any time.

2009-2017 © Rendered Text. All rights reserved. Terms of Service, Privacy policy, Security.