Skip to content
cloudhostDocs
API reference

Connected repositories

GitHub and GitLab connections; projects built from a repository on every push, with previews, commit statuses and pull request comments.

GET/v1/repos/config

What can be connected#

GitHub and GitLab availability on this platform.

Credential
An API key or a dashboard session
Roles
Any role

Response

200object

  • githubobject
    • availableboolean
  • gitlabobject
    • availableboolean
    • default_hoststring
    • hostsstring[]
    • custom_hostsboolean

Errors

StatusDescription
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden
500internal: an unexpected failure

Example

curl "https://api.ibel.ai/v1/repos/config" \
  -H "Authorization: Bearer $KEY"
GET/v1/repos/connections

The team's Git connections#

Credential
An API key or a dashboard session
Roles
Any role

Response

200object

  • connectionsobject[]
    • idstring (uuid)
    • providerstring

      one of github, gitlab

    • hoststring
    • loginstring | null
    • statusstring

      one of active, revoked

    • own_applicationboolean
    • projectsinteger
    • created_atstring (date-time)

Errors

StatusDescription
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden
500internal: an unexpected failure

Example

curl "https://api.ibel.ai/v1/repos/connections" \
  -H "Authorization: Bearer $KEY"
POST/v1/repos/connections

Start connecting GitHub or GitLab#

Returns the address to open and approve.

Credential
An API key or a dashboard session
Roles
owner, admin

Request bodyapplication/json

  • providerstringrequired

    one of github, gitlab

  • hoststring

    GitLab only: a self-hosted GitLab's https address

  • application_idstring
  • secretstring

Response

200object

  • providerstring
  • idstring
  • authorize_urlstring

Errors

StatusDescription
400bad_provider, bad_host, needs_application, bad_application
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden
500internal: an unexpected failure
503not_configured: connecting GitHub is not set up on this platform

Example

curl -X POST "https://api.ibel.ai/v1/repos/connections" \
  -H "Authorization: Bearer $KEY" \
  -d '{"provider":"github"}'
POST/v1/repos/connections/finish

Finish connecting GitHub or GitLab#

Called by the dashboard when the browser comes back from the Git host with ?finish=<ticket>. Only the person who began the connection, in the team it was begun for, can finish it, once.

Credential
An API key or a dashboard session
Roles
owner, admin

Request bodyapplication/json

  • ticketstringrequired

Response

200object

  • connectedstring (uuid)

Errors

StatusDescription
400Bad request: expired, failed
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden, not_starter, not_yours
409Conflict: taken
500internal: an unexpected failure
502The Git host did not answer: failed

Example

curl -X POST "https://api.ibel.ai/v1/repos/connections/finish" \
  -H "Authorization: Bearer $KEY" \
  -d '{"ticket":"…"}'
DELETE/v1/repos/connections/{id}

Remove a Git connection#

Credential
An API key or a dashboard session
Roles
owner, admin

Parameters

  • idstring (uuid)pathrequired
  • unlinkbooleanquery

    also unlink the projects that use it

Response

200object

  • idstring
  • deletedboolean
  • unlinkedobject[]

Errors

StatusDescription
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden
404not_found
409in_use: projects are linked; pass unlink=true
500internal: an unexpected failure

Example

curl -X DELETE "https://api.ibel.ai/v1/repos/connections/88e2fe1d-6d75-4de5-8c8f-27380ec66903" \
  -H "Authorization: Bearer $KEY"
GET/v1/repos/connections/{id}/repositories

Repositories a connection can reach#

Credential
An API key or a dashboard session
Roles
Any role

Parameters

  • idstring (uuid)pathrequired
  • qstringquery

    part of a repository name

Response

200object

  • repositoriesobject[]
    • idstring
    • namestring
    • default_branchstring
    • privateboolean
    • projectsobject[]

Errors

StatusDescription
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden
404not_found
500internal: an unexpected failure
502provider: the Git host did not answer

Example

curl "https://api.ibel.ai/v1/repos/connections/88e2fe1d-6d75-4de5-8c8f-27380ec66903/repositories" \
  -H "Authorization: Bearer $KEY"
POST/v1/repos/import

Make a project from a repository#

Creates the project, links it and builds the production branch.

Credential
An API key or a dashboard session
Roles
owner, admin, developer

Request bodyapplication/json

  • namestringrequired
  • kindstring

    one of app, function

  • connectionstringrequired
  • repostringrequired

    the repository's id from the repositories list

  • production_branchstring
  • previewsboolean

Response

201objectCreated

  • projectobject
  • repoobject
  • buildstring | null
  • commitstring | null

Errors

StatusDescription
400bad_name, bad_kind, bad_connection, bad_repo, bad_branch
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden
409name_taken
500internal: an unexpected failure

Example

curl -X POST "https://api.ibel.ai/v1/repos/import" \
  -H "Authorization: Bearer $KEY" \
  -d '{"name":"my-api","connection":"…","repo":"…"}'
GET/v1/apps/{name}/repo

The repository a project is built from#

Credential
An API key or a dashboard session
Roles
Any role

Parameters

  • namestringpathrequired

    the function's or app's name

    pattern ^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$ · up to 63 characters

Response

200object

  • connectionstring
  • providerstring
  • hoststring
  • repostring
  • repo_idstring
  • production_branchstring
  • previewsboolean
  • created_atstring (date-time)

Errors

StatusDescription
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden
404not_found, not_linked
500internal: an unexpected failure

Example

curl "https://api.ibel.ai/v1/apps/my-api/repo" \
  -H "Authorization: Bearer $KEY"
PUT/v1/apps/{name}/repo

Link a project to a repository#

Replaces an earlier link. GitLab: adds a webhook to the project.

Credential
An API key or a dashboard session
Roles
owner, admin, developer

Parameters

  • namestringpathrequired

    the function's or app's name

    pattern ^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$ · up to 63 characters

Request bodyapplication/json

  • connectionstringrequired
  • repostringrequired
  • production_branchstring
  • previewsboolean

Response

200object

  • connectionstring
  • providerstring
  • hoststring
  • repostring
  • repo_idstring
  • production_branchstring
  • previewsboolean
  • created_atstring (date-time)

Errors

StatusDescription
400bad_connection, bad_repo, bad_branch, bad_previews
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden
404not_found
500internal: an unexpected failure

Example

curl -X PUT "https://api.ibel.ai/v1/apps/my-api/repo" \
  -H "Authorization: Bearer $KEY" \
  -d '{"connection":"…","repo":"…"}'
DELETE/v1/apps/{name}/repo

Stop building a project from its repository#

Credential
An API key or a dashboard session
Roles
owner, admin, developer

Parameters

  • namestringpathrequired

    the function's or app's name

    pattern ^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$ · up to 63 characters

Response

200object

  • unlinkedboolean

Errors

StatusDescription
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden
404not_found, not_linked
500internal: an unexpected failure

Example

curl -X DELETE "https://api.ibel.ai/v1/apps/my-api/repo" \
  -H "Authorization: Bearer $KEY"
POST/v1/apps/{name}/repo/builds

Build a branch of the linked repository now#

Credential
An API key or a dashboard session
Roles
owner, admin, developer

Parameters

  • namestringpathrequired

    the function's or app's name

    pattern ^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$ · up to 63 characters

Request bodyapplication/json

  • branchstring

    default: the production branch

Response

201objectCreated

  • buildstring
  • branchstring
  • commitstring
  • productionboolean

Errors

StatusDescription
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden
404not_linked, no_branch
409not_built
500internal: an unexpected failure

Example

curl -X POST "https://api.ibel.ai/v1/apps/my-api/repo/builds" \
  -H "Authorization: Bearer $KEY" \
  -d '{"branch":"dev"}'
GET/v1/functions/{name}/repo

The repository a project is built from#

Credential
An API key or a dashboard session
Roles
Any role

Parameters

  • namestringpathrequired

    the function's or app's name

    pattern ^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$ · up to 63 characters

Response

200object

  • connectionstring
  • providerstring
  • hoststring
  • repostring
  • repo_idstring
  • production_branchstring
  • previewsboolean
  • created_atstring (date-time)

Errors

StatusDescription
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden
404not_found, not_linked
500internal: an unexpected failure

Example

curl "https://api.ibel.ai/v1/functions/my-api/repo" \
  -H "Authorization: Bearer $KEY"
PUT/v1/functions/{name}/repo

Link a project to a repository#

Replaces an earlier link. GitLab: adds a webhook to the project.

Credential
An API key or a dashboard session
Roles
owner, admin, developer

Parameters

  • namestringpathrequired

    the function's or app's name

    pattern ^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$ · up to 63 characters

Request bodyapplication/json

  • connectionstringrequired
  • repostringrequired
  • production_branchstring
  • previewsboolean

Response

200object

  • connectionstring
  • providerstring
  • hoststring
  • repostring
  • repo_idstring
  • production_branchstring
  • previewsboolean
  • created_atstring (date-time)

Errors

StatusDescription
400bad_connection, bad_repo, bad_branch, bad_previews
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden
404not_found
500internal: an unexpected failure

Example

curl -X PUT "https://api.ibel.ai/v1/functions/my-api/repo" \
  -H "Authorization: Bearer $KEY" \
  -d '{"connection":"…","repo":"…"}'
DELETE/v1/functions/{name}/repo

Stop building a project from its repository#

Credential
An API key or a dashboard session
Roles
owner, admin, developer

Parameters

  • namestringpathrequired

    the function's or app's name

    pattern ^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$ · up to 63 characters

Response

200object

  • unlinkedboolean

Errors

StatusDescription
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden
404not_found, not_linked
500internal: an unexpected failure

Example

curl -X DELETE "https://api.ibel.ai/v1/functions/my-api/repo" \
  -H "Authorization: Bearer $KEY"
POST/v1/functions/{name}/repo/builds

Build a branch of the linked repository now#

Credential
An API key or a dashboard session
Roles
owner, admin, developer

Parameters

  • namestringpathrequired

    the function's or app's name

    pattern ^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$ · up to 63 characters

Request bodyapplication/json

  • branchstring

    default: the production branch

Response

201objectCreated

  • buildstring
  • branchstring
  • commitstring
  • productionboolean

Errors

StatusDescription
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden
404not_linked, no_branch
409not_built
500internal: an unexpected failure

Example

curl -X POST "https://api.ibel.ai/v1/functions/my-api/repo/builds" \
  -H "Authorization: Bearer $KEY" \
  -d '{"branch":"dev"}'
POST/v1/repos/webhooks/github

Webhook from GitHub#

Called by GitHub; verified by X-Hub-Signature-256 (HMAC-SHA256 of the raw body). Roles: none (signature).

Credential
None

Parameters

  • X-Hub-Signature-256stringheaderrequired

    sha256=<hex>

  • X-GitHub-Eventstringheaderrequired

    the event type

Request bodyapplication/json

object

Response

202objectAccepted

  • okboolean
  • resultstring

Errors

StatusDescription
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden
500internal: an unexpected failure

Example

curl -X POST "https://api.ibel.ai/v1/repos/webhooks/github" \
  -d '{}'
POST/v1/repos/webhooks/gitlab/{link}

Webhook from GitLab#

Called by GitLab; verified by X-Gitlab-Token, one secret per linked project. Roles: none (token).

Credential
None

Parameters

  • linkstring (uuid)pathrequired
  • X-Gitlab-Tokenstringheaderrequired

    the project's hook secret

  • X-Gitlab-Eventstringheaderrequired

    Push Hook or Merge Request Hook

Request bodyapplication/json

object

Response

202objectAccepted

  • okboolean
  • resultstring

Errors

StatusDescription
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden
500internal: an unexpected failure

Example

curl -X POST "https://api.ibel.ai/v1/repos/webhooks/gitlab/link" \
  -d '{}'
GET/v1/repos/callback/github

Return from Github's approval page#

Connects nothing itself: redirects to the dashboard's Settings → Git with a one-time finish=<ticket> (finished there with the person's session, POST /v1/repos/connections/finish) or error=<code>. Roles: none (signed state).

Credential
None

Response

302Redirect to the dashboard

Errors

StatusDescription
500internal: an unexpected failure

Example

Request
curl "https://api.ibel.ai/v1/repos/callback/github"
GET/v1/repos/callback/gitlab

Return from Gitlab's approval page#

Connects nothing itself: redirects to the dashboard's Settings → Git with a one-time finish=<ticket> (finished there with the person's session, POST /v1/repos/connections/finish) or error=<code>. Roles: none (signed state).

Credential
None

Response

302Redirect to the dashboard

Errors

StatusDescription
500internal: an unexpected failure

Example

Request
curl "https://api.ibel.ai/v1/repos/callback/gitlab"