Signup | Signin

API Overview

The TIES Tanzania Gold Price API provides developers with access to real-time and historical gold price data for both local Tanzanian markets and international markets. Our API is designed to be simple, reliable, and easy to integrate into your applications.

Base URL: https://ties.co.tz/goldapi/

Key Features

Authentication

All API requests require authentication using a Bearer token. You'll receive your unique API token after registering for an account.

POST /api/register/

Register for a new API account to receive your authentication token.

Request Body

Parameter Type Required Description
username String Yes Your desired username
email String Yes Your email address
password String Yes Your password (min. 8 characters)
password_confirm String Yes Password confirmation
company_name String Yes Your company name
website String No Your company website (optional)

Example Request

{
  "username": "mycompany",
  "email": "info@mycompany.com",
  "password": "securepassword123",
  "password_confirm": "securepassword123",
  "company_name": "My Company Ltd",
  "website": "https://mycompany.com"
}

Example Response

Success 201
{ "message": "API user registered successfully", "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "username": "mycompany", "company_name": "My Company Ltd" }

You can get your token to profile section - signin to get token .
Once you have your token, include it in the Authorization header of all subsequent requests:

Authorization: Bearer your_token_here

API Endpoints

GET /api/prices/

Retrieve gold price data with optional date filtering parameters.

Query Parameters

Parameter Type Required Description
date Date No Specific date for data (YYYY-MM-DD)
start_date Date No Start date for historical data (YYYY-MM-DD)
end_date Date No End date for historical data (YYYY-MM-DD)

Usage Notes

  • Use either date parameter OR start_date and end_date parameters, not both
  • If no date parameters are provided, returns all available data
  • Returns all available price types, currencies, and units for the specified date(s)

Example Requests

# Get all prices
GET /api/prices/

# Get prices for a specific date
GET /api/prices/?date=2024-01-15

# Get prices within a date range
GET /api/prices/?start_date=2024-01-01&end_date=2024-01-31

Example Response

Success 200
{ "count": 150, "results": [ { "id": 1, "uploadedDate": "2024-01-15", "perGramWordTzs": "125000.00", "perGramWordUsd": "54.25", "perGramLocalTzs": "124500.00", "perGramLocalUsd": "53.98", "perKgWordTzs": "125000000.00", "perKgWordUsd": "54250.00", "perKgLocalTzs": "124500000.00", "perKgLocalUsd": "53980.00", "perTolaWordTzs": "145800.00", "perTolaWordUsd": "63.25", "perTolaLocalTzs": "145200.00", "perTolaLocalUsd": "62.98", "perTroyOunceWordTzs": "3885000.00", "perTroyOunceWordUsd": "1685.00", "perTroyOunceLocalTzs": "3870000.00", "perTroyOunceLocalUsd": "1678.50" }, { "id": 2, "uploadedDate": "2024-01-14", "perGramWordTzs": "124800.00", "perGramWordUsd": "54.10", "perGramLocalTzs": "124300.00", "perGramLocalUsd": "53.85", "perKgWordTzs": "124800000.00", "perKgWordUsd": "54100.00", "perKgLocalTzs": "124300000.00", "perKgLocalUsd": "53850.00", "perTolaWordTzs": "145500.00", "perTolaWordUsd": "63.10", "perTolaLocalTzs": "144900.00", "perTolaLocalUsd": "62.83", "perTroyOunceWordTzs": "3878000.00", "perTroyOunceWordUsd": "1682.00", "perTroyOunceLocalTzs": "3863000.00", "perTroyOunceLocalUsd": "1675.50" } ], "filters_applied": { "date": null, "start_date": "2024-01-01", "end_date": "2024-01-31" } }
GET /api/prices/latest/

Retrieve the latest gold price data with specific parameters.

Example Request

GET /api/prices/latest/

Example Response

Success 200
{ "date": "2025-08-21", "source": "TIES Tanzania", "prices": { "word": { "TZS": { "gram": 197437.5907740905, "kg": 197437590.7740905, "tola": 2369251.089289086, "troyounce": 6141000.0 }, "USD": { "gram": 73.94666321126984, "kg": 73946.66321126984, "tola": 887.3599585352381, "troyounce": 2300.0 } }, "local": { "TZS": { "gram": 177693.83169668145, "kg": 177693831.69668144, "tola": 2132325.9803601773, "troyounce": 5526900.0 }, "USD": { "gram": 66.55199689014286, "kg": 66551.99689014287, "tola": 798.6239626817143, "troyounce": 2070.0 } } } }
GET /api/profile/

Retrieve your API user profile information.

Example Response

Success 200
{ "username": "mycompany", "email": "info@mycompany.com", "company_name": "My Company Ltd", "website": "https://mycompany.com", "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "created_at": "2024-01-10T14:30:00Z" }

Quick Start Guide

Get up and running with our API in just a few simple steps.

1

Register for an API Account

Send a POST request to the registration endpoint to create your account and receive your API token.

POST /api/register/
2

Store Your Token Securely

Save the token you received in the registration response. You'll need it for all API requests.

3

Get Latest Price

Make a simple request to get the latest gold price with your preferred parameters.

GET /api/prices/latest/?type=local¤cy=TZS&unit=gram
4

Get Historical Data

Retrieve historical data using simple date filters.

GET /api/prices/?start_date=2024-01-01&end_date=2024-01-31

Support & Contact

If you need help with our API or have any questions, please don't hesitate to contact our support team.

Technical Support

Email: it@ties.co.tz

Response Time: Within 24 hours on business days

Error Codes

Code Description
400 Bad Request - Invalid parameters or date format
401 Unauthorized - Invalid or missing token
404 Not Found - Resource doesn't exist
429 Too Many Requests - Rate limit exceeded
500 Internal Server Error - Please contact support