> For the complete documentation index, see [llms.txt](https://docs.wellcomecollection.org/request-for-comments-rfcs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wellcomecollection.org/request-for-comments-rfcs/012-api_architecture.md).

# RFC 012: API Architecture

## Purpose

This RFC proposes a solution for serving Wellcome Collection APIs from a single domain, `api.wellcomecollection.org`, using AWS API Gateway and CloudFront.

**Last modified:** 2019-01-25T15:26:28+00:00

## Background

Wellcome Collection provides multiple APIs to interact with our data. A single API can be made up of multiple services, providing responses at different endpoints.

Some API endpoints require authentication, while others are public and would benefit from rate limiting.

## Problem statement

In order to provide a consistent location for Wellcome Collection APIs we'd like to serve all APIs from [api.wellcomecollection.org](https://api.wellcomecollection.org).

As of 09/01/2019 we are focusing on serving the `storage` and `catalogue` APIs from `api.wellcomecollection.org`. The `storage` API requires authentication, the catalogue API does not.

We are using [AWS API Gateway](https://aws.amazon.com/api-gateway/) to host our REST APIs and making use of a [private integration](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-private-integration.html) to serve requests via an [AWS ECS Service](https://aws.amazon.com/ecs/).

We wish to segregate infrastructure projects into different AWS accounts for simplicity and security. See [RFC: 009-aws\_account\_layout](/request-for-comments-rfcs/009-aws_account_layout.md).

Currently it is not possible to point a [Custom Domain](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html) from one account to another account using API Gateway.

## Proposed Solution

The recommended solution is to use an [AWS CloudFront Distribution](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-working-with.html) to field requests to `api.wellcomecollection.org` and then use [Custom Origins](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DownloadDistS3AndCustomOrigins.html#concept_CustomOrigin) to serve requests from API Gateway in other accounts using their own Custom Domains.

See:

![](/files/VJSzlzIhhUcudWOEEyTp)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wellcomecollection.org/request-for-comments-rfcs/012-api_architecture.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
