Docs / API Reference / Hive GraphQL API / Contract Management via the GraphQL API Contract Management via the GraphQL API Learn how to manage contracts via the Hive Console GraphQL API.
The contracts of a target can be managed via the Hive Console GraphQL API. For more information,
please refer to our schema contracts documentation .
Retrieve a list of all Contracts in Target
Use the Target.contracts field for retrieving a list of all existing contracts within the target.
Deleted contracts are not included.
query ContractTargets ( $targetId : ID ! ) {
target ( reference : { byId : $targetId }) {
id
contracts {
edges {
node {
id
contractName
includeTags
excludeTags
removeUnreachableTypesFromPublicApiSchema
viewerCanDeleteContract
}
}
pageInfo {
hasNextPage
endCursor
}
}
}
}
Create a Contract
Use the Mutation.createContract field for creating a new contract.
mutation CreateContract ( $input : CreateContractInput ! ) {
createContract ( input : $input ) {
ok {
createdContract {
id
contractName
includeTags
excludeTags
removeUnreachableTypesFromPublicApiSchema
}
}
error {
message
details {
target
contractName
includeTags
excludeTags
}
}
}
}
Delete a Contract
Use the Mutation.deleteContract field for permanently deleting a contract. This removes the
contract and its CDN artifacts and allows its name to be reused within the target.
mutation DeleteContract ( $input : DeleteContractInput ! ) {
deleteContract ( input : $input ) {
ok {
deletedContractId
}
error {
message
}
}
} ← Manage Access Tokens Manage Members →