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

# First Upload Setup

> Setting up your first upload endpoint

# First Upload Setup

This guide walks you through setting up your first upload endpoint as a distributor.

## Prerequisites

* Docyard account (signed up and verified)
* Business verification documents ready

## Step 1: Sign In

```bash theme={null}
curl -X POST https://api.docyard.io/v1/auth/signin \
  -H "Content-Type: application/json" \
  -d '{
    "email": "ops@acme-insurance.com",
    "password": "your-password"
  }'
```

**Response:**

```json theme={null}
{
  "distributor_id": "dist-abc123",
  "api_key": "dk_live_xxxxxxxxxxxx"
}
```

## Step 2: Create Your Upload

A upload endpoint is your upload endpoint. Create one for production use:

```bash theme={null}
curl -X POST https://api.docyard.io/v1/upload endpoints \
  -H "X-API-Key: dk_live_xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Production Upload",
    "description": "Main upload endpoint for insurance declarations"
  }'
```

**Response:**

```json theme={null}
{
  "upload endpoint_id": "upload endpoint-xyz789",
  "name": "Production Upload",
  "api_key": "dk_live_dist_aaaaaaaa",
  "api_secret": "dk_secret_dist_bbbbbbbb",
  "created_at": "2026-03-15T10:00:00Z"
}
```

**Important**: Save your `api_key` and `api_secret` securely.

## Step 3: Create a Development Upload (Optional)

Create a separate upload endpoint for testing:

```bash theme={null}
curl -X POST https://api.docyard.io/v1/upload endpoints \
  -H "X-API-Key: dk_live_xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Development Upload",
    "description": "Testing endpoint"
  }'
```

**Response:**

```json theme={null}
{
  "upload endpoint_id": "upload endpoint-dev-001",
  "name": "Development Upload",
  "api_key": "dk_test_dist_aaaaaaaa",
  "api_secret": "dk_test_secret_bbbbbbbb"
}
```

**Note**: Test keys use the `dk_test_` prefix.

## Step 4: Verify Your Upload

Test that your upload endpoint is working:

```bash theme={null}
curl -X GET https://api.docyard.io/v1/upload endpoints/upload endpoint-xyz789 \
  -H "X-API-Key: dk_live_dist_aaaaaaaa" \
  -H "X-API-Secret: dk_secret_dist_bbbbbbbb"
```

**Response:**

```json theme={null}
{
  "upload endpoint_id": "upload endpoint-xyz789",
  "name": "Production Upload",
  "status": "active",
  "stats": {
    "total_uploads": 0,
    "last_upload_at": null
  }
}
```

## Step 5: Create an Artifact Type Template

Before uploading, you need an artifact type template. Here's a basic insurance declaration template:

```bash theme={null}
curl -X POST https://api.docyard.io/v1/templates \
  -H "X-API-Key: dk_live_dist_aaaaaaaa" \
  -H "X-API-Secret: dk_secret_dist_bbbbbbbb" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Insurance Declaration Page",
    "description": "Standard insurance policy declaration document",
    "locks": [
      {
        "name": "policy_number",
        "data_type": "string",
        "description": "Insurance policy number",
        "validation": {
          "pattern": "^POL-[0-9]{8}$"
        },
        "weight": 20,
        "required": true
      },
      {
        "name": "effective_date",
        "data_type": "date",
        "description": "Date the policy becomes effective",
        "weight": 10,
        "required": true
      },
      {
        "name": "mortgagee_name",
        "data_type": "string",
        "description": "Name of the mortgagee/lender",
        "weight": 5,
        "required": false
      },
      {
        "name": "address",
        "data_type": "string",
        "description": "Property address",
        "weight": 5,
        "required": false
      }
    ]
  }'
```

**Response:**

```json theme={null}
{
  "template_id": "tmpl-ins-dec-001",
  "status": "pending_approval",
  "message": "Template submitted for admin review. You will be notified once approved."
}
```

## Step 6: Wait for Template Approval

Templates require admin review before use. This ensures quality and consistency.

You'll receive an email when your template is approved.

## Step 7: Upload Your First Artifact

Once approved, upload your first artifact:

```bash theme={null}
curl -X POST https://api.docyard.io/v1/upload/artifacts \
  -H "X-API-Key: dk_live_dist_aaaaaaaa" \
  -H "X-API-Secret: dk_secret_dist_bbbbbbbb" \
  -H "Content-Type: application/json" \
  -d '{
    "template_id": "tmpl-ins-dec-001",
    "locks": {
      "policy_number": { "value": "POL-12345678" },
      "effective_date": { "value": "2026-03-15" },
      "mortgagee_name": { "value": "FirstCity Bank" }
    },
    "threshold": 20,
    "content": "<base64-encoded-pdf>"
  }'
```

**Response:**

```json theme={null}
{
  "id": "art-abc123",
  "status": "active",
  "created_at": "2026-03-15T10:30:00Z"
}
```

## Managing Multiple Uploads

### List All Uploads

```bash theme={null}
curl -X GET https://api.docyard.io/v1/upload endpoints \
  -H "X-API-Key: dk_live_dist_aaaaaaaa"
```

**Response:**

```json theme={null}
{
  "upload endpoints": [
    {
      "upload endpoint_id": "upload endpoint-xyz789",
      "name": "Production Upload",
      "status": "active"
    },
    {
      "upload endpoint_id": "upload endpoint-dev-001",
      "name": "Development Upload",
      "status": "active"
    }
  ]
}
```

### Rotate API Keys

For security, rotate your keys periodically:

```bash theme={null}
curl -X POST https://api.docyard.io/v1/upload endpoints/upload endpoint-xyz789/rotate-keys \
  -H "X-API-Key: dk_live_dist_aaaaaaaa" \
  -H "X-API-Secret: dk_secret_dist_bbbbbbbb"
```

**Response:**

```json theme={null}
{
  "new_api_key": "dk_live_dist_cccccccc",
  "new_api_secret": "dk_secret_dist_dddddddd",
  "old_key_expires_at": "2026-03-16T10:30:00Z"
}
```

**Important**: Update your applications with the new keys before the old key expires.

### Delete a Upload

You can delete unused upload endpoints:

```bash theme={null}
curl -X DELETE https://api.docyard.io/v1/upload endpoints/upload endpoint-dev-001 \
  -H "X-API-Key: dk_live_dist_aaaaaaaa" \
  -H "X-API-Secret: dk_secret_dist_bbbbbbbb"
```

## Best Practices

### 1. Use Separate Uploads Per Environment

```
Production Upload:  dk_live_dist_*
Test Upload:        dk_test_dist_*
```

### 2. Secure Your API Keys

Never commit keys to version control:

```bash theme={null}
# .env (add to .gitignore)
DOCYARD_API_KEY=dk_live_dist_aaaaaaaa
DOCYARD_API_SECRET=dk_secret_dist_bbbbbbbb
```

### 3. Monitor Usage

Check your upload endpoint stats regularly:

```bash theme={null}
curl -X GET https://api.docyard.io/v1/upload endpoints/upload endpoint-xyz789/stats \
  -H "X-API-Key: dk_live_dist_aaaaaaaa"
```

### 4. Rotate Keys Regularly

Set a quarterly reminder to rotate API keys.

***

## Next Steps

* **[Creating Artifact Types](/guides/creating-artifact-types)** - Design templates for your documents
* **[Artifact Ingestion](/guides/artifact-ingestion)** - Learn upload strategies
* **\[API Reference]\(/api-reference/upload endpoints)** - Full upload endpoint API documentation
