Add registry | Integrations | Northflank API docs
v1
Double column
API
CLI
JS Client

Integrations /

Add registry

Adds a new set of container registry credentials to this account.

Required permission

Account > Credentials > General > Create

Request body

  • {object}
    • name

      string required

      Name of the credentials.

      min length
      3
      max length
      39
      pattern
      ^[a-zA-Z]((-|\s)?[a-zA-Z0-9]+((-|\s)[a-zA-Z0-9]+)*)?$
    • description

      string required

      Description of the credentials.

      max length
      200
      pattern
      ^[a-zA-Z0-9.,?\s\\/'"()[\];`%^&*\-_:!]+$
    • provider

      string required

      The registry provider associated with this set of credentials.

      one of
      dockerhub, gcr, gcr-eu, gcr-us, gitlab, github, custom
    • restrictions

      {object}

      Data about whether the credentials are restricted to certain projects.

      • restricted

        boolean

        Whether the credentials are restricted to specific projects.

      • projects

        [array]

        An array of projects the credentials are restricted to, if applicable.

        • string

          The id of the project.

          pattern
          ^[A-Za-z0-9-]+$
    • registryUrl

      string

      Custom url for the container registry. Only usable (and required) when provider is custom.

    • username

      string required

      Username for the container registry.

    • password

      string required

      Password, Personal Access Token, or API key for the container registry.

OR
  • {object}

    Authenticate with a keyfile.json. Used for authenticating with Google Container Registry.

    • name

      string required

      Name of the credentials.

      min length
      3
      max length
      39
      pattern
      ^[a-zA-Z]((-|\s)?[a-zA-Z0-9]+((-|\s)[a-zA-Z0-9]+)*)?$
    • description

      string required

      Description of the credentials.

      max length
      200
      pattern
      ^[a-zA-Z0-9.,?\s\\/'"()[\];`%^&*\-_:!]+$
    • provider

      string required

      The registry provider associated with this set of credentials.

      one of
      dockerhub, gcr, gcr-eu, gcr-us, gitlab, github, custom
    • restrictions

      {object}

      Data about whether the credentials are restricted to certain projects.

      • restricted

        boolean

        Whether the credentials are restricted to specific projects.

      • projects

        [array]

        An array of projects the credentials are restricted to, if applicable.

        • string

          The id of the project.

          pattern
          ^[A-Za-z0-9-]+$
    • registryUrl

      string

      Custom url for the container registry. Only usable (and required) when provider is custom.

    • keyfile

      {object} required

      Contents of keyfile.json, used to authenticate with Google Container Registry.

    OR
    • {object}

      Validate with a docker config file.

      • name

        string required

        Name of the credentials.

        min length
        3
        max length
        39
        pattern
        ^[a-zA-Z]((-|\s)?[a-zA-Z0-9]+((-|\s)[a-zA-Z0-9]+)*)?$
      • description

        string required

        Description of the credentials.

        max length
        200
        pattern
        ^[a-zA-Z0-9.,?\s\\/'"()[\];`%^&*\-_:!]+$
      • provider

        string required

        The registry provider associated with this set of credentials.

        one of
        dockerhub, gcr, gcr-eu, gcr-us, gitlab, github, custom
      • restrictions

        {object}

        Data about whether the credentials are restricted to certain projects.

        • restricted

          boolean

          Whether the credentials are restricted to specific projects.

        • projects

          [array]

          An array of projects the credentials are restricted to, if applicable.

          • string

            The id of the project.

            pattern
            ^[A-Za-z0-9-]+$
      • auths

        {object} required

        The auths data extracted from your Docker config file.

      Response body

      • {object}

        Response object.

        • data

          {object} required

          Result data.

          • id

            string required

            Identifier for the credentials.

          • name

            string required

            Name of the saved credentials.

          • description

            string required

            Description of the saved credentials.

          • restrictions

            {object} required

            Data about whether the credentials are restricted to certain projects.

            • restricted

              boolean required

              Whether the credentials are restricted to specific projects.

            • projects

              [array] required

              An array of projects the credentials are restricted to, if applicable.

              • string

                The id of the project.

          • provider

            string required

            The registry provider associated with this set of credentials.

            one of
            dockerhub, gcr, gcr-eu, gcr-us, gitlab, github, custom
      API
      CLI
      JS Client

      POST /v1/integrations/registries

      Example request

      Request body
      curl
      curl --header "Content-Type: application/json" \
        --header "Authorization: Bearer NORTHFLANK_API_TOKEN" \
        --request POST \
        --data '{"name":"Example Credentials","description":"This is a set of saved credentials.","provider":"dockerhub","restrictions":{"restricted":true,"projects":["default-project"]},"registryUrl":"https://example.com","username":"test-user","password":"password1234"}' \
        https://api.northflank.com/v1/integrations/registries
      OR
      Authenticate with a `keyfile.json`. Used for authenticating with Google Container Registry.
      curl
      curl --header "Content-Type: application/json" \
        --header "Authorization: Bearer NORTHFLANK_API_TOKEN" \
        --request POST \
        --data '{"name":"Example Credentials","description":"This is a set of saved credentials.","provider":"dockerhub","restrictions":{"restricted":true,"projects":["default-project"]},"registryUrl":"https://example.com","keyfile":{"type":"service_account","project_id":"[PROJECT_ID]","private_key_id":"[KEY_ID]","private_key":"-----BEGIN PRIVATE KEY-----\n ... \n-----END PRIVATE KEY-----\n","client_email":"[SERVICE_ACCOUNT_EMAIL]","client_id":"[CLIENT_ID]","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://accounts.google.com/o/oauth2/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_x509_cert_url":"https://www.googleapis.com/robot/v1/metadata/x509/[SERVICE_ACCOUNT_EMAIL]"}}' \
        https://api.northflank.com/v1/integrations/registries
      OR
      Validate with a docker config file.
      curl
      curl --header "Content-Type: application/json" \
        --header "Authorization: Bearer NORTHFLANK_API_TOKEN" \
        --request POST \
        --data '{"name":"Example Credentials","description":"This is a set of saved credentials.","provider":"dockerhub","restrictions":{"restricted":true,"projects":["default-project"]},"auths":{"https://index.docker.io/v1/":{"auth":"[YOUR AUTH KEY]"}}}' \
        https://api.northflank.com/v1/integrations/registries

      Example response

      200 OK

      Data about the newly created credentials.

      JSON

      {
        "data": {
          "id": "example-credentials",
          "name": "Example Credentials",
          "description": "This is a set of saved credentials.",
          "restrictions": {
            "restricted": true,
            "projects": [
              "default-project"
            ]
          },
          "provider": "dockerhub"
        }
      }

      © 2024 Northflank Ltd. All rights reserved.