> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qoder.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Register a resource

> Register an existing resource as a Forward Resource.

`POST /api/v1/forward/resources/registry`

Registers an existing resource by ID. This endpoint has upsert semantics: first registration returns `201 Created`, while subsequent registration updates return `200 OK`.

## Headers

| Header            | Required | Description                                   |
| ----------------- | -------- | --------------------------------------------- |
| `Authorization`   | Yes      | `Bearer <PAT>`                                |
| `Content-Type`    | Yes      | `application/json`                            |
| `Idempotency-Key` | No       | Optional idempotency key for unsafe requests. |

## Body parameters

| Parameter     | Type   | Required | Description                                                               |
| ------------- | ------ | -------- | ------------------------------------------------------------------------- |
| `type`        | string | Yes      | Resource type. Supported values: `skill`, `file`, `vault`, `environment`. |
| `resource`    | object | Yes      | Resource object. Only `resource.id` is used.                              |
| `resource.id` | string | Yes      | Resource ID, such as `skill_...` or `file_...`.                           |

## Example request

```bash theme={null}
curl -s -X POST 'https://api.qoder.com/api/v1/forward/resources/registry' \
  -H "Authorization: Bearer $QODER_PAT" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "skill",
    "resource": {
      "id": "skill_xxx"
    }
  }'
```

## Example response

**HTTP 201 Created**

```json theme={null}
{
  "id": "skill_xxx",
  "type": "skill"
}
```

## Response fields

| Field  | Type   | Description                                            |
| ------ | ------ | ------------------------------------------------------ |
| `id`   | string | Forward Resource ID. Directly matches the resource ID. |
| `type` | string | Resource type.                                         |

## Errors

| HTTP | Type                    | Trigger                                                                          |
| ---- | ----------------------- | -------------------------------------------------------------------------------- |
| 400  | `invalid_request_error` | Missing or unsupported `type`, missing `resource.id`, or malformed body.         |
| 401  | `authentication_error`  | PAT invalid or expired.                                                          |
| 403  | `permission_error`      | Caller has no access to the resource.                                            |
| 404  | `not_found_error`       | Resource does not exist, or declared `type` does not match actual resource type. |

## Notes

* Create or update the resource through the resource API before registering it with Forward.

## Related

<CardGroup cols={2}>
  <Card title="List resources" icon="list" href="/cloud-agents/api/forward/resources/list" />

  <Card title="Create a template" icon="plus" href="/cloud-agents/api/forward/templates/create" />
</CardGroup>
