# Create an application (/docs/api-reference/hooks-applications/create-hook-application)

Creates an application: one of your customers (or users), who gets their own endpoints and portal. Give it a `uid` (e.g. your customer's id) to address it by in every path. Hooks resources belong to the API key's own environment: a `coss_test_…` key only ever sees sandbox ones, a `coss_live_…` key only production ones.

`POST https://api.coss.com/v1/hooks/applications`

Authenticate with your API key as a bearer token (`Authorization: Bearer coss_test_…`). Responses are JSON with snake_case fields; errors are `{ error: { type, code, message, param?, issues?, request_id } }` (https://coss.com/docs/api-reference/errors.md).

## Request body

- `name` (string, required, 1-256 characters): Shown to the application's users in the portal.
- `uid` (string): Your own id for it, to address it by in every path instead of its `id`.
- `metadata` (map of string): Your own key-value pairs (at most 16; keys up to 40 characters, values up to 500).

## Example request

TypeScript (the `coss` package):

```ts
import { Coss } from "coss";

const coss = new Coss({
  apiKey: process.env.COSS_API_KEY,
  baseUrl: "https://api.coss.com",
});

const { data, error } = await coss.hooks.applications.create({
  name: "Acme Corp",
  uid: "customer_8812",
  metadata: {
    plan: "pro",
  },
});
```

HTTP:

```sh
curl -X POST "https://api.coss.com/v1/hooks/applications" \
  -H "Authorization: Bearer $COSS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Acme Corp",
  "uid": "customer_8812",
  "metadata": {
    "plan": "pro"
  }
}'
```

Python:

```python
from coss import Coss

client = Coss()  # api_key= or COSS_API_KEY

client.hooks.applications.create(
    name="Acme Corp",
    uid="customer_8812",
    metadata={
        "plan": "pro"
    },
)
```

Go:

```go
import (
	"context"

	coss "github.com/cosscom/coss-go"
	cossclient "github.com/cosscom/coss-go/client"
	hooks "github.com/cosscom/coss-go/hooks"
)

client := cossclient.NewClient() // option.WithAPIKey(…) or COSS_API_KEY

request := &hooks.CreateHookApplicationRequest{
    Name: "Acme Corp",
    UID: coss.String(
        "customer_8812",
    ),
    Metadata: map[string]string{
        "plan": "pro",
    },
}
client.Hooks.Applications.Create(
    context.TODO(),
    request,
)
```

Ruby:

```ruby
require "coss"

client = Coss::Client.new # api_key: or COSS_API_KEY

client.hooks.applications.create(
  name: "Acme Corp",
  uid: "customer_8812",
  metadata: {
    plan: "pro"
  }
)
```

PHP:

```php
<?php

use Coss\Coss;
use Coss\Hooks\Applications\Requests\CreateHookApplicationRequest;

$client = new Coss(); // apiKey: or COSS_API_KEY

$client->hooks->applications->create(
    new CreateHookApplicationRequest([
        'name' => 'Acme Corp',
        'uid' => 'customer_8812',
        'metadata' => [
            'plan' => 'pro',
        ],
    ]),
);
```

Java:

```java
import com.coss.Coss;
import com.coss.resources.hooks.applications.requests.CreateHookApplicationRequest;
import java.util.HashMap;

Coss client = Coss.builder().build(); // .apiKey(…) or COSS_API_KEY

client.hooks().applications().create(
    CreateHookApplicationRequest
        .builder()
        .name("Acme Corp")
        .uid("customer_8812")
        .metadata(
            new HashMap<String, String>() {{
                put("plan", "pro");
            }}
        )
        .build()
);
```

.NET:

```csharp
using Coss;
using Coss.Hooks;

var client = new CossClient(); // apiKey: or COSS_API_KEY

await client.Hooks.Applications.CreateAsync(
    new CreateHookApplicationRequest
    {
        Name = "Acme Corp",
        Uid = "customer_8812",
        Metadata = new Dictionary<string, string>() { { "plan", "pro" } },
    }
);
```

## Response 200

The application.

- `object` ("hook_application", required)
- `id` (string, required)
- `uid` (string | null, required): Your own id for it (e.g. your customer's id), unique in the environment. Every path that takes an application accepts its `id` or its `uid`.
- `name` (string, required): Shown to the application's users in the portal.
- `metadata` (map of string, required): Your own key-value pairs.
- `created_at` (string, required, date-time)
- `updated_at` (string, required, date-time)

Example:

```json
{
  "object": "hook_application",
  "id": "happ_01k7c8m4q2f3e9v6t5r1n0p8yz",
  "uid": "customer_8812",
  "name": "Acme Corp",
  "metadata": {
    "plan": "pro"
  },
  "created_at": "2026-01-15T09:30:00.000Z",
  "updated_at": "2026-01-15T09:30:00.000Z"
}
```

## Errors

- `400`: The body is not valid JSON (`invalid_json`). Also when the `Coss-Version` header names an unknown API version (`invalid_api_version`).
- `401`: The API key is missing, invalid, revoked or expired (`authentication_error`).
- `403`: The API key lacks the permission this endpoint needs (`permission_error`), or its organization is suspended (`organization_suspended`).
- `413`: The request body is larger than 5 MB (`payload_too_large`).
- `415`: The body is not sent as `application/json` (`unsupported_media_type`).
- `422`: The body failed validation (`validation_error`), the `uid` is taken (`uid_taken`), or the environment has the most applications it can (100,000 live, 100 sandbox: `too_many_applications`).
- `429`: Too many requests with this API key (`rate_limited`), or too many requests with invalid keys from this address (`too_many_failed_authentications`). Retry after `Retry-After` seconds. Successful responses carry `RateLimit-Limit`, `RateLimit-Remaining` and `RateLimit-Reset` (seconds until the limit is fully restored).
- `500`: Unexpected server error (`api_error` / `internal_error`).
- `503`: The API key could not be verified right now; retry (`service_unavailable`).