# Getting Started

We designed the PactFlow API using the REST principles. Our API has predictable resource-oriented URLs, accepts and returns JSON-encoded bodies, and uses standard HTTP response codes, authentication, and verbs.

This documentation covers the APIs for both the PactFlow SaaS and [on-premises](https://docs.pactflow.io/docs/on-premises) distributions.

## Hypermedia API

The PactFlow API is a [Richardson Maturity Model Level 3](https://martinfowler.com/articles/richardsonMaturityModel.html#level3) compliant hypermedia API using the [Hypertext Application Language (HAL)](https://en.wikipedia.org/wiki/Hypertext_Application_Language) convention for modelling relationships between resources. 

When using the PactFlow API, specify the primary content type as `application/hal+json`, in the `Accept` header of all HTTP requests.

Hypermedia APIs provide the means to see and move between related resources via *relations*. For further information, see [Requests and Responses](./requests).

## Key Resources

The PactFlow API provides access to the following collections of resources and capabilities:

* Audit logs 
* Branch management
* Can I Deploy
* Consumer and provider contracts
* Environment management
* Metrics
* Integration management
* Pacticipants (applications)
* Permissions management
* User and system preferences
* Deployments and releases
* User roles
* Secrets
* Team management
* Access tokens
* User management
* Webhooks management

## Prerequisites

You must have a valid PactFlow SaaS account or on-premises distribution. You can register for a free PactFlow account [here](https://pactflow.io/try-for-free/).

## Base Info

The PactFlow API is available at the same URL as the PactFlow web application and uses content-negotiation to return the appropriate media type - such as HTML or JSON.

**Base URL Endpoint:** The PactFlow API base endpoint is `https://{account}.pactflow.io`, where `{account}` is your unique account URL assigned when registering a PactFlow account. For example, if you login to `https://xyz.pactflow.io` this would be the API endpoint.

For on-premises deployments, this will be the URL to which your PactFlow instance is accessible.

## Compatibility with the Pact Broker

The PactFlow API is compatible with the open source [Pact Broker](https://github.com/pact-foundation/pact_broker/). All tooling that works with the Pact Broker will continue to work with PactFlow.

***

### Differences

1. PactFlow's role-based access model (RBAC) is applied to resources such as publishing pacts or managing webhooks. See [Authentication and Authorization](./authentication) for more on this.
2. Some APIs are enriched with additional information (such as the [/metrics](/pactflow/default/pactflow_saas_api#/metric/get_metrics) endpoint).
 
## SaaS vs On-Premises Distributions

Some APIs are available only to the SaaS or On-Premises distributions. These resources will be flagged as such in their descriptions and/tags. If no designation is present, you may assume the API is available to both distributions.
