Semaphore Secrets API

Organization-level secrets

OpenAPI Specification

semaphore-secrets-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Semaphore Public Dashboards Secrets API
  description: 'The Semaphore Public API is a RESTful API that allows you to interact with Semaphore CI/CD.

    ## Authorization

    Authorization is done via bearer token. You can obtain a token by visiting your [account settings](https://me.semaphoreci.com/account).


    ## Pagination with link headers

    Each list request supports pagination. List responses include a [link header](https://datatracker.ietf.org/doc/html/rfc5988#section-5) with the pagination URLs.

    Link headers contain next, previous, first relative URLs.

    '
  version: v2
  contact:
    url: https://semaphore.io/contact
    email: support@semaphoreci.com
  termsOfService: https://semaphore.io/terms
  license:
    name: Proprietary
    url: https://semaphore.io/terms
servers:
- url: https://{org_name}.semaphoreci.com/api/v2
  variables:
    org_name:
      default: me
      description: Organization name
security:
- authorization: []
tags:
- name: Secrets
  description: Organization-level secrets
paths:
  /secrets:
    post:
      operationId: Secrets.Create
      description: Create an organization secret.
      tags:
      - Secrets
      requestBody:
        content:
          application/json:
            schema:
              properties:
                apiVersion:
                  default: v2
                  description: "ApiVersion defines the versioned schema of this representation of an object.\n        Servers should convert recognized schemas to the latest internal value, and may reject\n        unrecognized values."
                  example: v2
                  readOnly: true
                  title: ApiVersion
                  type: string
                kind:
                  default: Secret
                  description: "Kind is a string value representing the REST resource this object represents.\n        Servers may infer this from the endpoint the client submits requests to. Cannot be\n        updated. In CamelCase."
                  example: Secret
                  readOnly: true
                  title: Kind
                  type: string
                metadata:
                  description: Metadata of the secret, all fields are read only
                  properties:
                    created_at:
                      description: Timestamp in ISO 8601 format
                      format: date-time
                      title: Timestamp
                      type: string
                    created_by:
                      properties:
                        id:
                          description: ID of a User
                          example: 18b40eaf-ce10-49c3-93f2-e4fe72d5160b
                          format: uuid
                          title: User.ID
                          type: string
                      title: User
                      type: object
                    description:
                      description: Description of the secret
                      type: string
                    id:
                      description: ID of a Secret
                      example: b6654945-cf11-43a1-8e3a-f5a22c7d19fa
                      format: uuid
                      title: Secret.ID
                      type: string
                    last_used_at:
                      description: Last time the secret was used in a job
                      format: date-time
                      nullable: true
                      title: Timestamp
                      type: string
                    last_used_by:
                      description: Collected information about last usage of the secret
                      nullable: true
                      properties:
                        hook_id:
                          description: ID of a Hook
                          example: c0798875-7908-456b-ab3e-78de8247b6e0
                          format: uuid
                          title: Hook.ID
                          type: string
                        job_id:
                          description: ID of a Job
                          example: 7ce0901c-84b0-4bb4-ab96-f0a4b15ae52d
                          format: uuid
                          title: Job.ID
                          type: string
                        pipeline_id:
                          description: ID of a Pipeline
                          example: 4cd4fdb9-4248-4348-932c-855746110bcc
                          format: uuid
                          title: Pipeline.ID
                          type: string
                        project_id:
                          description: ID of a Project
                          example: 1c306e24-af58-4e95-8cd9-27e9a1a36428
                          format: uuid
                          title: Project.ID
                          type: string
                        user_id:
                          description: ID of a User
                          example: 7a8f94b1-c5b6-4195-82ca-f68664fa832b
                          format: uuid
                          title: User.ID
                          type: string
                        workflow_id:
                          description: ID of a Workflow
                          example: 40dcd7b2-3e42-4958-8c08-7eb5aa8690f6
                          format: uuid
                          title: Workflow.ID
                          type: string
                      title: Secrets.Checkout
                      type: object
                    name:
                      description: Secret name must match the regex
                      example: my-secret
                      minLength: 1
                      pattern: '^[@: -._a-zA-Z0-9]+$'
                      title: Secret.Name
                      type: string
                    org_id:
                      description: ID of a Organization
                      example: 476f994f-76bc-4ff1-9cdf-5092d29236cf
                      format: uuid
                      title: Organization.ID
                      type: string
                    updated_at:
                      description: Timestamp in ISO 8601 format
                      format: date-time
                      title: Timestamp
                      type: string
                    updated_by:
                      properties:
                        id:
                          description: ID of a User
                          example: 18b40eaf-ce10-49c3-93f2-e4fe72d5160b
                          format: uuid
                          title: User.ID
                          type: string
                      title: User
                      type: object
                  readOnly: true
                  required:
                  - id
                  - name
                  - org_id
                  type: object
                spec:
                  description: Specification of the secret
                  properties:
                    access_config:
                      description: "Access configuration of the secret if the feature is enabled.\n    More info: https://docs.semaphoreci.com/essentials/using-secrets/#organization-level-secrets-access-policy"
                      properties:
                        attach_access:
                          default: 'YES'
                          description: "Field determining if you can attach to a job using this secret\n         - YES = attach mode is enabled for this secret\n         - NO  = attach mode is disabled for this secret"
                          enum:
                          - 'YES'
                          - 'NO'
                          type: string
                        debug_access:
                          default: 'YES'
                          description: "Field determining if secret can be used in debug jobs\n         - YES = debug mode is enabled for this secret\n         - NO  = debug mode is disabled for this secret"
                          enum:
                          - 'YES'
                          - 'NO'
                          type: string
                        project_access:
                          default: ALL
                          description: "Field determining if projects can use the secret contents\n         - ALL      = all projects can use this secret\n         - ALLOWED  = oly projects whitelisted in project_ids will be able to read this secret\n         - NONE     = no projects can access contents of the secret"
                          enum:
                          - ALL
                          - ALLOWED
                          - NONE
                          type: string
                        project_ids:
                          default: []
                          description: List of project ids that can use the secret contents if project_access is set to ALLOWED
                          items:
                            description: ID of a Project
                            example: 0e7fa31e-f974-4f57-ab99-72ac8b70df41
                            format: uuid
                            title: Project.ID
                            type: string
                          type: array
                      title: Secrets.AccessConfig
                      type: object
                    data:
                      description: Data of the secret, both env_vars and files are required but can be empty
                      properties:
                        env_vars:
                          description: Environment variables of the secret
                          items:
                            description: EnvVar
                            properties:
                              name:
                                description: Name of the environment variable
                                example: MY_SECRET
                                minLength: 1
                                type: string
                              value:
                                description: Value of the environment variable
                                example: secret
                                minLength: 1
                                type: string
                            required:
                            - name
                            - value
                            title: Secrets.Secret.EnvVar
                            type: object
                          type: array
                        files:
                          description: Files of the secret
                          items:
                            description: File
                            properties:
                              content:
                                description: base64 encoded content of the file or a md5 checksum
                                type: string
                              path:
                                description: Name of the file. Both absolute and relative paths are allowed.
                                example: /path/to/file
                                minLength: 1
                                type: string
                            required:
                            - path
                            - content
                            title: Secrets.Secret.File
                            type: object
                          type: array
                      required:
                      - env_vars
                      - files
                      type: object
                    description:
                      description: Description of the secret
                      type: string
                    name:
                      description: Secret name must match the regex
                      example: my-secret
                      minLength: 1
                      pattern: '^[@: -._a-zA-Z0-9]+$'
                      title: Secret.Name
                      type: string
                  required:
                  - name
                  - data
                  type: object
              required:
              - apiVersion
              - kind
              - metadata
              - spec
              title: Secrets.Secret
              type: object
        description: Secret to be created
        required: false
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  apiVersion:
                    default: v2
                    description: "ApiVersion defines the versioned schema of this representation of an object.\n        Servers should convert recognized schemas to the latest internal value, and may reject\n        unrecognized values."
                    example: v2
                    readOnly: true
                    title: ApiVersion
                    type: string
                  kind:
                    default: Secret
                    description: "Kind is a string value representing the REST resource this object represents.\n        Servers may infer this from the endpoint the client submits requests to. Cannot be\n        updated. In CamelCase."
                    example: Secret
                    readOnly: true
                    title: Kind
                    type: string
                  metadata:
                    description: Metadata of the secret, all fields are read only
                    properties:
                      created_at:
                        description: Timestamp in ISO 8601 format
                        format: date-time
                        title: Timestamp
                        type: string
                      created_by:
                        properties:
                          id:
                            description: ID of a User
                            example: 18b40eaf-ce10-49c3-93f2-e4fe72d5160b
                            format: uuid
                            title: User.ID
                            type: string
                        title: User
                        type: object
                      description:
                        description: Description of the secret
                        type: string
                      id:
                        description: ID of a Secret
                        example: b6654945-cf11-43a1-8e3a-f5a22c7d19fa
                        format: uuid
                        title: Secret.ID
                        type: string
                      last_used_at:
                        description: Last time the secret was used in a job
                        format: date-time
                        nullable: true
                        title: Timestamp
                        type: string
                      last_used_by:
                        description: Collected information about last usage of the secret
                        nullable: true
                        properties:
                          hook_id:
                            description: ID of a Hook
                            example: c0798875-7908-456b-ab3e-78de8247b6e0
                            format: uuid
                            title: Hook.ID
                            type: string
                          job_id:
                            description: ID of a Job
                            example: 7ce0901c-84b0-4bb4-ab96-f0a4b15ae52d
                            format: uuid
                            title: Job.ID
                            type: string
                          pipeline_id:
                            description: ID of a Pipeline
                            example: 4cd4fdb9-4248-4348-932c-855746110bcc
                            format: uuid
                            title: Pipeline.ID
                            type: string
                          project_id:
                            description: ID of a Project
                            example: 1c306e24-af58-4e95-8cd9-27e9a1a36428
                            format: uuid
                            title: Project.ID
                            type: string
                          user_id:
                            description: ID of a User
                            example: 7a8f94b1-c5b6-4195-82ca-f68664fa832b
                            format: uuid
                            title: User.ID
                            type: string
                          workflow_id:
                            description: ID of a Workflow
                            example: 40dcd7b2-3e42-4958-8c08-7eb5aa8690f6
                            format: uuid
                            title: Workflow.ID
                            type: string
                        title: Secrets.Checkout
                        type: object
                      name:
                        description: Secret name must match the regex
                        example: my-secret
                        minLength: 1
                        pattern: '^[@: -._a-zA-Z0-9]+$'
                        title: Secret.Name
                        type: string
                      org_id:
                        description: ID of a Organization
                        example: 476f994f-76bc-4ff1-9cdf-5092d29236cf
                        format: uuid
                        title: Organization.ID
                        type: string
                      updated_at:
                        description: Timestamp in ISO 8601 format
                        format: date-time
                        title: Timestamp
                        type: string
                      updated_by:
                        properties:
                          id:
                            description: ID of a User
                            example: 18b40eaf-ce10-49c3-93f2-e4fe72d5160b
                            format: uuid
                            title: User.ID
                            type: string
                        title: User
                        type: object
                    readOnly: true
                    required:
                    - id
                    - name
                    - org_id
                    type: object
                  spec:
                    description: Specification of the secret
                    properties:
                      access_config:
                        description: "Access configuration of the secret if the feature is enabled.\n    More info: https://docs.semaphoreci.com/essentials/using-secrets/#organization-level-secrets-access-policy"
                        properties:
                          attach_access:
                            default: 'YES'
                            description: "Field determining if you can attach to a job using this secret\n         - YES = attach mode is enabled for this secret\n         - NO  = attach mode is disabled for this secret"
                            enum:
                            - 'YES'
                            - 'NO'
                            type: string
                          debug_access:
                            default: 'YES'
                            description: "Field determining if secret can be used in debug jobs\n         - YES = debug mode is enabled for this secret\n         - NO  = debug mode is disabled for this secret"
                            enum:
                            - 'YES'
                            - 'NO'
                            type: string
                          project_access:
                            default: ALL
                            description: "Field determining if projects can use the secret contents\n         - ALL      = all projects can use this secret\n         - ALLOWED  = oly projects whitelisted in project_ids will be able to read this secret\n         - NONE     = no projects can access contents of the secret"
                            enum:
                            - ALL
                            - ALLOWED
                            - NONE
                            type: string
                          project_ids:
                            default: []
                            description: List of project ids that can use the secret contents if project_access is set to ALLOWED
                            items:
                              description: ID of a Project
                              example: 0e7fa31e-f974-4f57-ab99-72ac8b70df41
                              format: uuid
                              title: Project.ID
                              type: string
                            type: array
                        title: Secrets.AccessConfig
                        type: object
                      data:
                        description: Data of the secret, both env_vars and files are required but can be empty
                        properties:
                          env_vars:
                            description: Environment variables of the secret
                            items:
                              description: EnvVar
                              properties:
                                name:
                                  description: Name of the environment variable
                                  example: MY_SECRET
                                  minLength: 1
                                  type: string
                                value:
                                  description: Value of the environment variable
                                  example: secret
                                  minLength: 1
                                  type: string
                              required:
                              - name
                              - value
                              title: Secrets.Secret.EnvVar
                              type: object
                            type: array
                          files:
                            description: Files of the secret
                            items:
                              description: File
                              properties:
                                content:
                                  description: base64 encoded content of the file or a md5 checksum
                                  type: string
                                path:
                                  description: Name of the file. Both absolute and relative paths are allowed.
                                  example: /path/to/file
                                  minLength: 1
                                  type: string
                              required:
                              - path
                              - content
                              title: Secrets.Secret.File
                              type: object
                            type: array
                        required:
                        - env_vars
                        - files
                        type: object
                      description:
                        description: Description of the secret
                        type: string
                      name:
                        description: Secret name must match the regex
                        example: my-secret
                        minLength: 1
                        pattern: '^[@: -._a-zA-Z0-9]+$'
                        title: Secret.Name
                        type: string
                    required:
                    - name
                    - data
                    type: object
                required:
                - apiVersion
                - kind
                - metadata
                - spec
                title: Secrets.Secret
                type: object
          description: Created secret
        '400':
          content:
            application/json:
              schema:
                properties:
                  documentation_url:
                    example: https://docs.semaphoreci.com/api/error-codes/bad-request
                    format: uri
                    type: string
                  message:
                    type: string
                title: Error
                type: object
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                properties:
                  documentation_url:
                    example: https://docs.semaphoreci.com/api/error-codes/bad-request
                    format: uri
                    type: string
                  message:
                    type: string
                title: Error
                type: object
          description: Unauthorized
        '404':
          content:
            application/json:
              schema:
                properties:
                  documentation_url:
                    example: https://docs.semaphoreci.com/api/error-codes/bad-request
                    format: uri
                    type: string
                  message:
                    type: string
                title: Error
                type: object
          description: Not Found
        '422':
          content:
            application/json:
              schema:
                description: Resource validation failed
                properties:
                  documentation_url:
                    example: https://docs.semaphoreci.com/api/error-codes/bad-request
                    format: uri
                    type: string
                  errors:
                    items:
                      properties:
                        field:
                          type: string
                        message:
                          type: string
                      type: object
                    type: array
                  message:
                    type: string
                title: Error.Validation
                type: object
          description: Validation Failed
        '500':
          content:
            application/json:
              schema:
                properties:
                  documentation_url:
                    example: https://docs.semaphoreci.com/api/error-codes/bad-request
                    format: uri
                    type: string
                  message:
                    type: string
                title: Error
                type: object
          description: Internal Server Error
      security:
      - authorization: []
    get:
      operationId: Secrets.List
      description: "List all organization level secrets.\n      If the response does not fit all the secrets refer to the link header to get next page url."
      tags:
      - Secrets
      parameters:
      - description: Ordering of the secrets
        in: query
        name: order
        required: false
        schema:
          default: BY_NAME_ASC
          enum:
          - BY_NAME_ASC
          - BY_CREATE_TIME_ASC
          type: string
      - description: Starting point for listing, if you are fetching first page leave it empty
        in: query
        name: page_token
        required: false
        schema:
          default: ''
          type: string
      - description: Page size
        in: query
        name: page_size
        required: false
        schema:
          default: 20
          maximum: 100
          minimum: 1
          title: PageSize
          type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  properties:
                    apiVersion:
                      default: v2
                      description: "ApiVersion defines the versioned schema of this representation of an object.\n        Servers should convert recognized schemas to the latest internal value, and may reject\n        unrecognized values."
                      example: v2
                      readOnly: true
                      title: ApiVersion
                      type: string
                    kind:
                      default: Secret
                      description: "Kind is a string value representing the REST resource this object represents.\n        Servers may infer this from the endpoint the client submits requests to. Cannot be\n        updated. In CamelCase."
                      example: Secret
                      readOnly: true
                      title: Kind
                      type: string
                    metadata:
                      description: Metadata of the secret, all fields are read only
                      properties:
                        created_at:
                          description: Timestamp in ISO 8601 format
                          format: date-time
                          title: Timestamp
                          type: string
                        created_by:
                          properties:
                            id:
                              description: ID of a User
                              example: 18b40eaf-ce10-49c3-93f2-e4fe72d5160b
                              format: uuid
                              title: User.ID
                              type: string
                          title: User
                          type: object
                        description:
                          description: Description of the secret
                          type: string
                        id:
                          description: ID of a Secret
                          example: b6654945-cf11-43a1-8e3a-f5a22c7d19fa
                          format: uuid
                          title: Secret.ID
                          type: string
                        last_used_at:
                          description: Last time the secret was used in a job
                          format: date-time
                          nullable: true
                          title: Timestamp
                          type: string
                        last_used_by:
                          description: Collected information about last usage of the secret
                          nullable: true
                          properties:
                            hook_id:
                              description: ID of a Hook
                              example: c0798875-7908-456b-ab3e-78de8247b6e0
                              format: uuid
                              title: Hook.ID
                              type: string
                            job_id:
                              description: ID of a Job
                              example: 7ce0901c-84b0-4bb4-ab96-f0a4b15ae52d
                              format: uuid
                              title: Job.ID
                              type: string
                            pipeline_id:
                              description: ID of a Pipeline
                              example: 4cd4fdb9-4248-4348-932c-855746110bcc
                              format: uuid
                              title: Pipeline.ID
                              type: string
                            project_id:
                              description: ID of a Project
                              example: 1c306e24-af58-4e95-8cd9-27e9a1a36428
                              format: uuid
                              title: Project.ID
                              type: string
                            user_id:
                              description: ID of a User
                              example: 7a8f94b1-c5b6-4195-82ca-f68664fa832b
                              format: uuid
                              title: User.ID
                              type: string
                            workflow_id:
                              description: ID of a Workflow
                              example: 40dcd7b2-3e42-4958-8c08-7eb5aa8690f6
                              format: uuid
                              title: Workflow.ID
                              type: string
                          title: Secrets.Checkout
                          type: object
                        name:
                          description: Secret name must match the regex
                          example: my-secret
                          minLength: 1
                          pattern: '^[@: -._a-zA-Z0-9]+$'
                          title: Secret.Name
                          type: string
                        org_id:
                          description: ID of a Organization
                          example: 476f994f-76bc-4ff1-9cdf-5092d29236cf
                          format: uuid
                          title: Organization.ID
      

# --- truncated at 32 KB (85 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/semaphore/refs/heads/main/openapi/semaphore-secrets-api-openapi.yml