Skip to content

Latest commit

 

History

History
136 lines (116 loc) · 1.99 KB

API.md

File metadata and controls

136 lines (116 loc) · 1.99 KB

API Documentation

Overview

This document describes the REST and GraphQL APIs for the Arweave Data Repository.

Authentication

All API endpoints require authentication unless explicitly marked as public.

Authentication Header

Authorization: Bearer <jwt_token>

REST API Endpoints

Data Management

Store Data

POST /api/v1/data
Content-Type: application/json

{
  "data": any,
  "type": DataType,
  "permissions": PermissionLevel,
  "metadata": {
    "tags": [
      { "name": string, "value": string }
    ]
  }
}

Retrieve Data

GET /api/v1/data/:id

Query Data

GET /api/v1/data?type=&creator=&limit=&cursor=

Token Operations

Get Balance

GET /api/v1/tokens/balance

Transfer Tokens

POST /api/v1/tokens/transfer
Content-Type: application/json

{
  "recipient": string,
  "amount": number
}

GraphQL API

Queries

query GetData($id: ID!) {
  getData(id: $id) {
    id
    type
    metadata {
      size
      hash
    }
  }
}

query QueryData($type: DataType, $limit: Int) {
  queryData(type: $type, limit: $limit) {
    edges {
      node {
        id
        type
      }
      cursor
    }
    pageInfo {
      hasNextPage
      endCursor
    }
  }
}

Mutations

mutation StoreData($input: DataInput!) {
  storeData(input: $input) {
    id
    type
  }
}

mutation UpdatePermissions($id: ID!, $level: PermissionLevel!) {
  updatePermissions(id: $id, level: $level) {
    id
    permissionLevel
  }
}

Subscriptions

subscription OnDataUpdated($type: DataType) {
  dataUpdated(type: $type) {
    id
    type
    metadata {
      size
      hash
    }
  }
}

Error Handling

All endpoints return standard error responses:

{
  "error": {
    "code": string,
    "message": string,
    "details": object
  }
}