---
# System prepended metadata

title: '[Draft] How to write APIs for FTL'
tags: [docs, draft]

---

# How to write APIs for FTL

FTL provides three primary types of synchronous APIs: **Verbs**, **Ingress Endpoints**, and **Egress Endpoints**. This guide will walk you through using each type efficiently.

## Verbs

Verbs in FTL are implemented using gRPC and are utilized in two main scenarios:

1. **Internal RPC:** For calling functions within the same FTL module.
2. **Exported RPC:** For enabling inter-module communication.

### Defining a Private Verb

To define a verb that is only accessible within its own module, use the following annotation:

```go
// ftl:verb
func GetSomething(ctx context.Context, req MyRequest) (MyResponse, error) {
    // Implementation here
}
```

### Making a Verb Public

If you intend for the verb to be callable by other modules, include the `export` keyword in the annotation:

```go
// ftl:verb export
func GetSomething(ctx context.Context, req MyRequest) (MyResponse, error) {
    // Implementation here
}
```

### Calling a Verb

When using the command line or in tests, verbs are referenced by `<module name>.<verb name>`. Note that the verb name is case sensitive and may be formatted differently; for example, `GetMyID` should be called as `getMyId`.

## Ingress Endpoints

Ingress endpoints are ideal for scenarios where you need external accessibility, such as third-party webhooks. These endpoints allow methods to be called over the web, facilitating easier integration with external services and applications.