Pin or follow a branch
A mock server always serves exactly one commit. Its update strategy decides how that commit changes. Both types of mock server support both strategies.
| Pin to commit | Follow branch | |
|---|---|---|
| Serves | The commit it was published from | The latest good commit of the branch |
| Updates | When you publish it again | Automatically, at every update of the branch |
| Good for | A released version, a partner sandbox, a reproducible test | A development or integration environment |
| Plans | Every plan | Team and Enterprise |
Pinning is the default in the publish dialog.
Follow a branch
When you publish from a branch, choose Follow branch under Update Strategy. The mock is published from the head of the branch and is republished at every update of it: a push, a merged pull request, a file saved in the APIGit editor, or a pull-mirror sync.
Several updates in quick succession are combined, and the mock goes straight to the newest head.

The URL, the access token and, for a code-based mock, the state stay the same across updates, so clients never need to change anything.
Change the strategy later
Open the mock server, choose Setting, and change Update Strategy:
- Pin to commit it serves now stops the updates and keeps the current commit.
- Follow branch publishes the head of the chosen branch at once and follows it from then on. Use this to point a mock at a different branch too.
A failed update never takes the mock down
If a new commit cannot be published, the mock server keeps serving its last good commit, and its page shows the reason and the commit that failed. The next update of the branch tries again.
| What happened | What the mock does | What to do |
|---|---|---|
The new commit cannot be published: a served document was deleted or is invalid, a document has a remote $ref, the limits are exceeded, or apigit-mock/ is missing or over 2 MiB | Keeps serving the last good commit | Fix it on the branch. The next update publishes normally. |
| The branch was deleted or renamed | Keeps serving its last commit | Point the mock at another branch, or pin it |
| The publisher’s account moved to the Free plan | Keeps serving its last commit and stops updating | Upgrade or pin. Following resumes on a paid plan. |
Published API documents have the same two strategies. See Publish an API Document.