External api schema
See Management API schema for every domain, the endpoint and authentication.
Queries
externalApi
Reads an external API. Null when it does not exist.
Scope: ORGANIZATION_INTEGRATIONS_READ.
externalApi(input: ExternalApiInput!): ExternalApi @authMutations
externalApiCreate
Creates an external API in a project, with an optional credential.
Scope: ORGANIZATION_INTEGRATIONS_CREATE.
externalApiCreate(input: ExternalApiCreateInput!): ExternalApiCreatePayload! @auth(only: USER)externalApiUpdate
Updates the name of an external API. To change the origin, delete it and create another.
Scope: ORGANIZATION_INTEGRATIONS_UPDATE.
externalApiUpdate(input: ExternalApiUpdateInput!): ExternalApiUpdatePayload! @auth(only: USER)externalApiAuthHeaderSet
Sets the static auth header of an external API, and removes any OAuth2 credential.
Scope: ORGANIZATION_INTEGRATIONS_UPDATE.
externalApiAuthHeaderSet(input: ExternalApiAuthHeaderSetInput!): ExternalApiAuthHeaderSetPayload! @auth(only: USER)externalApiAuthHeaderClear
Removes the static auth header of an external API. An external API with no static header is
unchanged.
Scope: ORGANIZATION_INTEGRATIONS_UPDATE.
externalApiAuthHeaderClear(input: ExternalApiAuthHeaderClearInput!): ExternalApiAuthHeaderClearPayload! @auth(only: USER)externalApiOAuth2Set
Sets the OAuth2 credential of an external API, and removes any static auth header. The next call
fetches a new access token.
Scope: ORGANIZATION_INTEGRATIONS_UPDATE.
externalApiOAuth2Set(input: ExternalApiOAuth2SetInput!): ExternalApiOAuth2SetPayload! @auth(only: USER)externalApiOAuth2Clear
Removes the OAuth2 credential of an external API, with its secrets and cached access token. An
external API with no OAuth2 credential is unchanged.
Scope: ORGANIZATION_INTEGRATIONS_UPDATE.
externalApiOAuth2Clear(input: ExternalApiOAuth2ClearInput!): ExternalApiOAuth2ClearPayload! @auth(only: USER)externalApiOAuth2Refresh
Fetches a new access token for the OAuth2 credential of an external API now, in place of any
cached one. An external API with no OAuth2 credential is refused.
Scope: ORGANIZATION_INTEGRATIONS_UPDATE.
externalApiOAuth2Refresh(input: ExternalApiOAuth2RefreshInput!): ExternalApiOAuth2RefreshPayload! @auth(only: USER)externalApiDelete
Deletes an external API and its credential. Workflows then cannot call its origin.
Scope: ORGANIZATION_INTEGRATIONS_DELETE.
externalApiDelete(input: ExternalApiDeleteInput!): ExternalApiDeletePayload! @auth(only: USER)Types
ExternalApiAuthKind
"""How an external API authenticates the requests a workflow sends it."""
enum ExternalApiAuthKind {
"""No credential."""
NONE
"""A static auth header, set with `externalApiAuthHeaderSet`."""
HEADER
"""
An OAuth2 credential, set with `externalApiOAuth2Set`. Picked fetches, caches and refreshes the access token.
"""
OAUTH2
}ExternalApiOAuth2Grant
"""The OAuth2 grant that fetches the access token of an external API."""
enum ExternalApiOAuth2Grant {
"""
The refresh-token grant (RFC 6749 section 6), which sends a stored refresh token.
"""
REFRESH_TOKEN
"""
The client-credentials grant (RFC 6749 section 4.4), which sends the client alone.
"""
CLIENT_CREDENTIALS
}ExternalApiOAuth2ClientAuth
"""Where the token request carries the client ID and the client secret."""
enum ExternalApiOAuth2ClientAuth {
"""As `client_id` and `client_secret` parameters in the form body."""
BODY
"""In an `Authorization: Basic` header."""
BASIC
}ExternalApiCredentialFailureReason
"""
Why Picked could not get an access token. A failed `http` node records the same reason, in lower
case, as `error.reason`.
"""
enum ExternalApiCredentialFailureReason {
"""
The token endpoint refused the credential, such as with `invalid_client` or `invalid_grant`. Not retryable: the credential needs fixing.
"""
CREDENTIAL_REJECTED
"""
The token endpoint timed out, could not be reached, answered 429 or 5xx, or sent no token, or the node timed out first. Retryable; calls fail at once for 60 seconds after.
"""
CREDENTIAL_REFRESH_FAILED
"""
A secret of the credential is missing. Not retryable: set the credential again.
"""
CREDENTIAL_UNAVAILABLE
}ExternalApiOAuth2TokenParam
"""An extra parameter of the token request, such as `scope`."""
type ExternalApiOAuth2TokenParam {
"""The name of the parameter."""
name: String!
"""The value of the parameter."""
value: String!
}ExternalApiOAuth2RefreshOn401
"""
The 401 responses that mark the access token as expired: those whose JSON body holds one of
`values` at `path`.
"""
type ExternalApiOAuth2RefreshOn401 {
"""
A dot-separated path into the response body, such as `code`. A segment of digits indexes an array.
"""
path: String!
"""
The values at `path` that mark the token as expired, such as `INVALID_TOKEN`.
"""
values: [String!]!
}ExternalApiOAuth2RefreshFailure
"""The last failed refresh of an access token."""
type ExternalApiOAuth2RefreshFailure {
"""Why the refresh failed."""
reason: ExternalApiCredentialFailureReason!
"""When the refresh failed."""
failedAt: DateTime!
}ExternalApiOAuth2
"""
The OAuth2 credential of an external API. Picked sends `<headerScheme> <access token>` in
`headerName`, refreshes the token from `tokenUrl` 60 seconds before it expires, and retries once
with a new token after a 401 that `refreshOn401` matches.
"""
type ExternalApiOAuth2 {
"""The grant the token request uses."""
grant: ExternalApiOAuth2Grant!
"""The token endpoint, an `https` URL."""
tokenUrl: String!
"""The OAuth2 client ID."""
clientId: String!
"""Whether a client secret is set. The secret is never returned."""
clientSecretSet: Boolean!
"""
Whether a refresh token is set. Always false for `CLIENT_CREDENTIALS`. The token is never returned.
"""
refreshTokenSet: Boolean!
"""Where the token request carries the client."""
clientAuth: ExternalApiOAuth2ClientAuth!
"""The extra parameters of the token request, such as `scope`."""
tokenParams: [ExternalApiOAuth2TokenParam!]!
"""The header that carries the access token, such as `Authorization`."""
headerName: String!
"""
The scheme before the access token in the header, such as `Bearer` or `Zoho-oauthtoken`.
"""
headerScheme: String!
"""
The 401 responses that mark the token as expired. Null when every 401 does.
"""
refreshOn401: ExternalApiOAuth2RefreshOn401
"""
When Picked last stored a new access token. Null before the first refresh.
"""
lastRefreshedAt: DateTime
"""
The last failed refresh. Null when the last refresh succeeded or none has run.
"""
lastRefreshFailure: ExternalApiOAuth2RefreshFailure
}ExternalApi
"""
An origin that the workflows of a project can call with the `http` tool, and the credential that
Picked attaches to those calls. Secrets are encrypted at rest and never returned.
"""
type ExternalApi {
"""The ID of the external API."""
id: ID!
"""The ID of the project the external API belongs to."""
projectId: ID!
"""The name of the external API."""
name: String!
"""
The origin: scheme, host and optional port, with no path, such as `https://api.vendor.test`. The
host is lower case and a default port is dropped. Every path on the origin is allowed.
"""
origin: String!
"""The kind of credential."""
authKind: ExternalApiAuthKind!
"""
The name of the static auth header. Null when there is no static header.
"""
authHeaderName: String
"""
Whether a static auth header value is set. The value is never returned.
"""
authHeaderSet: Boolean!
"""The OAuth2 credential. Null unless `authKind` is `OAUTH2`."""
oauth2: ExternalApiOAuth2
"""When the external API was created."""
createdAt: DateTime!
"""When the external API last changed."""
updatedAt: DateTime!
}ExternalApiEdge
"""An external API in a page of results."""
type ExternalApiEdge {
"""The cursor of this edge."""
cursor: String!
"""The external API."""
node: ExternalApi!
}ExternalApiConnection
"""A page of external APIs, newest first."""
type ExternalApiConnection {
"""The edges in this page."""
edges: [ExternalApiEdge!]!
"""Where this page sits in the list."""
pageInfo: PageInfo!
"""The total number of external APIs in the project."""
totalCount: Int!
}ExternalApiAuthHeaderInput
"""A static auth header for the calls to an external API."""
input ExternalApiAuthHeaderInput {
"""The name of the header. Defaults to `authorization`."""
name: String
"""The value of the header. Encrypted at rest and never returned."""
value: String!
}ExternalApiOAuth2TokenParamInput
"""An extra parameter of the token request."""
input ExternalApiOAuth2TokenParamInput {
"""The name of the parameter."""
name: String!
"""The value of the parameter."""
value: String!
}ExternalApiOAuth2RefreshOn401Input
"""The 401 responses that mark the access token as expired."""
input ExternalApiOAuth2RefreshOn401Input {
"""
A dot-separated path into the response body, such as `code`. A segment of digits indexes an array.
"""
path: String!
"""
The values at `path` that mark the token as expired, such as `INVALID_TOKEN`. At least one.
"""
values: [String!]!
}ExternalApiOAuth2Input
"""
An OAuth2 credential to set when creating an external API. Secrets are encrypted at rest and
never returned.
"""
input ExternalApiOAuth2Input {
"""The grant the token request uses."""
grant: ExternalApiOAuth2Grant!
"""
The token endpoint: a public `https` URL on port 443 or 80, with no fragment and no `grant_type`,
`client_id`, `client_secret`, `refresh_token` or `code` in its query. Its origin is not
registered.
"""
tokenUrl: String!
"""The OAuth2 client ID."""
clientId: String!
"""The client secret. Required."""
clientSecret: String
"""
The refresh token. Required for `REFRESH_TOKEN`; refused for `CLIENT_CREDENTIALS`.
"""
refreshToken: String
"""Where the token request carries the client. Defaults to `BODY`."""
clientAuth: ExternalApiOAuth2ClientAuth
"""
The extra parameters of the token request, such as `scope`. `grant_type`, `client_id`,
`client_secret`, `refresh_token` and `code` are refused.
"""
tokenParams: [ExternalApiOAuth2TokenParamInput!]
"""The header that carries the access token. Defaults to `Authorization`."""
headerName: String
"""
The scheme before the access token, an HTTP token with no spaces. Defaults to `Bearer`.
"""
headerScheme: String
"""
The 401 responses that mark the token as expired. Omit to match every 401.
"""
refreshOn401: ExternalApiOAuth2RefreshOn401Input
}ExternalApiInput
"""The input of `externalApi`."""
input ExternalApiInput {
"""The ID of the external API."""
id: ID!
}ExternalApiCreateInput
"""The input of `externalApiCreate`."""
input ExternalApiCreateInput {
"""The ID of the project."""
projectId: ID!
"""The name of the external API."""
name: String!
"""
The origin to allow: `http` or `https`, a host and an optional port 80 or 443, with no path,
query, fragment or credentials. The host must not resolve to a private, loopback, link-local or
reserved address.
"""
origin: String!
"""A static auth header. Not allowed with `oauth2`."""
authHeader: ExternalApiAuthHeaderInput
"""An OAuth2 credential. Not allowed with `authHeader`."""
oauth2: ExternalApiOAuth2Input
}ExternalApiUpdateInput
"""The input of `externalApiUpdate`. Every field is required."""
input ExternalApiUpdateInput {
"""The ID of the external API."""
id: ID!
"""The name of the external API."""
name: String!
}ExternalApiAuthHeaderSetInput
"""The input of `externalApiAuthHeaderSet`."""
input ExternalApiAuthHeaderSetInput {
"""The ID of the external API."""
id: ID!
"""The name of the header. Defaults to `authorization`."""
name: String
"""The value of the header. Encrypted at rest and never returned."""
value: String!
}ExternalApiAuthHeaderClearInput
"""The input of `externalApiAuthHeaderClear`."""
input ExternalApiAuthHeaderClearInput {
"""The ID of the external API."""
id: ID!
}ExternalApiOAuth2SetInput
"""
The input of `externalApiOAuth2Set`. An omitted secret keeps the one set, unless `tokenUrl`,
`clientId` or `clientAuth` changes.
"""
input ExternalApiOAuth2SetInput {
"""The ID of the external API."""
id: ID!
"""The grant the token request uses."""
grant: ExternalApiOAuth2Grant!
"""
The token endpoint: a public `https` URL on port 443 or 80, with no fragment and no `grant_type`,
`client_id`, `client_secret`, `refresh_token` or `code` in its query. Its origin is not
registered.
"""
tokenUrl: String!
"""The OAuth2 client ID."""
clientId: String!
"""
The client secret. Required when none is set, or when `tokenUrl`, `clientId` or `clientAuth`
changes.
"""
clientSecret: String
"""
The refresh token. For `REFRESH_TOKEN`, required when none is set, or when `tokenUrl`, `clientId`
or `clientAuth` changes. Refused for `CLIENT_CREDENTIALS`.
"""
refreshToken: String
"""Where the token request carries the client. Defaults to `BODY`."""
clientAuth: ExternalApiOAuth2ClientAuth
"""
The extra parameters of the token request, such as `scope`. `grant_type`, `client_id`,
`client_secret`, `refresh_token` and `code` are refused.
"""
tokenParams: [ExternalApiOAuth2TokenParamInput!]
"""The header that carries the access token. Defaults to `Authorization`."""
headerName: String
"""
The scheme before the access token, an HTTP token with no spaces. Defaults to `Bearer`.
"""
headerScheme: String
"""
The 401 responses that mark the token as expired. Omit to match every 401.
"""
refreshOn401: ExternalApiOAuth2RefreshOn401Input
}ExternalApiOAuth2ClearInput
"""The input of `externalApiOAuth2Clear`."""
input ExternalApiOAuth2ClearInput {
"""The ID of the external API."""
id: ID!
}ExternalApiOAuth2RefreshInput
"""The input of `externalApiOAuth2Refresh`."""
input ExternalApiOAuth2RefreshInput {
"""The ID of the external API."""
id: ID!
}ExternalApiDeleteInput
"""The input of `externalApiDelete`."""
input ExternalApiDeleteInput {
"""The ID of the external API."""
id: ID!
}ExternalApiCreatePayload
"""The result of `externalApiCreate`."""
type ExternalApiCreatePayload {
"""The external API. Null when `errors` is not empty."""
externalApi: ExternalApi
"""
The errors: `ORIGIN_ALREADY_REGISTERED` on `origin` when the project already has the origin. Empty
on success.
"""
errors: [UserError!]!
}ExternalApiUpdatePayload
"""The result of `externalApiUpdate`."""
type ExternalApiUpdatePayload {
"""The external API."""
externalApi: ExternalApi
"""The errors. Always empty."""
errors: [UserError!]!
}ExternalApiAuthHeaderSetPayload
"""The result of `externalApiAuthHeaderSet`."""
type ExternalApiAuthHeaderSetPayload {
"""The external API."""
externalApi: ExternalApi
"""The errors. Always empty."""
errors: [UserError!]!
}ExternalApiAuthHeaderClearPayload
"""The result of `externalApiAuthHeaderClear`."""
type ExternalApiAuthHeaderClearPayload {
"""The external API."""
externalApi: ExternalApi
"""The errors. Always empty."""
errors: [UserError!]!
}ExternalApiOAuth2SetPayload
"""The result of `externalApiOAuth2Set`."""
type ExternalApiOAuth2SetPayload {
"""The external API."""
externalApi: ExternalApi
"""The errors. Always empty."""
errors: [UserError!]!
}ExternalApiOAuth2ClearPayload
"""The result of `externalApiOAuth2Clear`."""
type ExternalApiOAuth2ClearPayload {
"""The external API."""
externalApi: ExternalApi
"""The errors. Always empty."""
errors: [UserError!]!
}ExternalApiOAuth2RefreshPayload
"""The result of `externalApiOAuth2Refresh`."""
type ExternalApiOAuth2RefreshPayload {
"""
The external API after the refresh. `oauth2.lastRefreshedAt` moves on a new token, and
`oauth2.lastRefreshFailure` says why there is none.
"""
externalApi: ExternalApi
"""The errors. Always empty."""
errors: [UserError!]!
}ExternalApiDeletePayload
"""The result of `externalApiDelete`."""
type ExternalApiDeletePayload {
"""Whether the external API was deleted."""
success: Boolean!
"""The errors. Always empty."""
errors: [UserError!]!
}