---
title: Repositories API
description: "API endpoints for listing, creating, updating, and deleting source repositories in FileRelay."
---

# Repositories API

The Repositories API lets you manage source repositories (sources) in your FileRelay workspace programmatically. Repositories map to SAP Content Repositories and act as the entry points for documents.

## List Repositories

Retrieve all repositories in the current workspace.

```
GET /api/{userSlug}/{workspaceSlug}/repositories
```

### Query Parameters

| Parameter  | Type    | Description                         | Default |
|-----------|---------|-------------------------------------|---------|
| `page`    | integer | Page number                         | 1       |
| `per_page`| integer | Items per page (max 100)            | 25      |
| `status`  | string  | Filter by `active` or `inactive`    | --      |

### Example Request

```bash
curl -X GET "https://filerelay.dev/api/acme/production/repositories" \
  -H "Authorization: Bearer fr_live_abc123def456" \
  -H "Accept: application/json"
```

### Example Response

```json
{
  "data": [
    {
      "id": "repo_abc123",
      "type": "repository",
      "attributes": {
        "repo_id": "Z1",
        "name": "Production ECC Invoices",
        "status": "active",
        "signature_verification": true,
        "document_count": 14523,
        "created_at": "2026-01-15T08:00:00Z",
        "updated_at": "2026-04-01T12:30:00Z"
      }
    },
    {
      "id": "repo_def456",
      "type": "repository",
      "attributes": {
        "repo_id": "A2",
        "name": "S/4HANA Purchase Orders",
        "status": "active",
        "signature_verification": false,
        "document_count": 8741,
        "created_at": "2026-02-20T14:00:00Z",
        "updated_at": "2026-03-28T09:15:00Z"
      }
    }
  ],
  "meta": {
    "current_page": 1,
    "per_page": 25,
    "total": 2
  }
}
```

## Get a Single Repository

Retrieve details for a specific repository.

```
GET /api/{userSlug}/{workspaceSlug}/repositories/:id
```

### Example Request

```bash
curl -X GET "https://filerelay.dev/api/acme/production/repositories/repo_abc123" \
  -H "Authorization: Bearer fr_live_abc123def456" \
  -H "Accept: application/json"
```

### Example Response

```json
{
  "data": {
    "id": "repo_abc123",
    "type": "repository",
    "attributes": {
      "repo_id": "Z1",
      "name": "Production ECC Invoices",
      "status": "active",
      "signature_verification": true,
      "document_count": 14523,
      "certificates": [
        {
          "id": "cert_xyz789",
          "subject": "SAP System PRD",
          "valid_from": "2025-06-01T00:00:00Z",
          "valid_to": "2027-06-01T00:00:00Z",
          "status": "active"
        }
      ],
      "connections": [
        {
          "id": "conn_111",
          "destination_name": "S3 Production Archive",
          "status": "active"
        },
        {
          "id": "conn_222",
          "destination_name": "SharePoint Team Site",
          "status": "active"
        }
      ],
      "created_at": "2026-01-15T08:00:00Z",
      "updated_at": "2026-04-01T12:30:00Z"
    }
  }
}
```

## Create a Repository

Create a new source repository in the workspace.

```
POST /api/{userSlug}/{workspaceSlug}/repositories
```

### Request Body

| Field                    | Type    | Required | Description                                    |
|-------------------------|---------|----------|------------------------------------------------|
| `repo_id`               | string  | Yes      | Repository ID (must match SAP OAC0 config)     |
| `name`                  | string  | Yes      | Display name                                   |
| `signature_verification`| boolean | No       | Enable signature verification (default: false) |

### Example Request

```bash
curl -X POST "https://filerelay.dev/api/acme/production/repositories" \
  -H "Authorization: Bearer fr_live_abc123def456" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "repo_id": "B3",
    "name": "BW Archive Repository",
    "signature_verification": false
  }'
```

### Example Response

```json
{
  "data": {
    "id": "repo_ghi789",
    "type": "repository",
    "attributes": {
      "repo_id": "B3",
      "name": "BW Archive Repository",
      "status": "active",
      "signature_verification": false,
      "document_count": 0,
      "created_at": "2026-04-04T11:00:00Z",
      "updated_at": "2026-04-04T11:00:00Z"
    }
  }
}
```

Returns `201 Created` on success.

## Update a Repository

Update an existing repository's configuration.

```
PATCH /api/{userSlug}/{workspaceSlug}/repositories/:id
```

### Request Body

| Field                    | Type    | Required | Description                          |
|-------------------------|---------|----------|--------------------------------------|
| `name`                  | string  | No       | Updated display name                 |
| `status`                | string  | No       | Set to `active` or `inactive`        |
| `signature_verification`| boolean | No       | Enable or disable verification       |

**Note:** The `repo_id` cannot be changed after creation. To use a different repo_id, delete the repository and create a new one.

### Example Request

```bash
curl -X PATCH "https://filerelay.dev/api/acme/production/repositories/repo_ghi789" \
  -H "Authorization: Bearer fr_live_abc123def456" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "name": "BW Archive - Updated",
    "signature_verification": true
  }'
```

### Example Response

```json
{
  "data": {
    "id": "repo_ghi789",
    "type": "repository",
    "attributes": {
      "repo_id": "B3",
      "name": "BW Archive - Updated",
      "status": "active",
      "signature_verification": true,
      "document_count": 0,
      "created_at": "2026-04-04T11:00:00Z",
      "updated_at": "2026-04-04T11:05:00Z"
    }
  }
}
```

Returns `200 OK` on success.

## Delete a Repository

Permanently delete a repository and all associated certificates. Active connections to this repository are also removed.

```
DELETE /api/{userSlug}/{workspaceSlug}/repositories/:id
```

### Example Request

```bash
curl -X DELETE "https://filerelay.dev/api/acme/production/repositories/repo_ghi789" \
  -H "Authorization: Bearer fr_live_abc123def456"
```

Returns `204 No Content` on success.

**Warning:** This action is irreversible. Documents already delivered to destinations are not affected, but no new documents can be received for this repository.

## Next Steps

- [Documents API](/docs/api/documents) -- Query documents received through repositories
- [Destinations API](/docs/api/destinations) -- Manage destination connectors
- [Sources Overview](/docs/sources/overview) -- Understand how repositories work
