> For the complete documentation index, see [llms.txt](https://gotrustcrow.gitbook.io/trustcrow-api-v1/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gotrustcrow.gitbook.io/trustcrow-api-v1/api-reference/transaction/fetch-milestones.md).

# Fetch milestones

Milestone transactions are necessary for buying and selling of services as it ensures sellers get paid only after achieving specific goals. All transactions inherently involve milestone stages. Parties can create as many milestones as needed within each transaction.

## Fetch all milestones by transaction

<mark style="color:blue;">`GET`</mark> `{{api_url}}/v1/transactions/{transaction_id}/milestones`

#### Query Parameters

| Name                                              | Type   | Description                |
| ------------------------------------------------- | ------ | -------------------------- |
| transaction\_id<mark style="color:red;">\*</mark> | string | specify the transaction id |

#### Headers

| Name          | Type   | Description                                    |
| ------------- | ------ | ---------------------------------------------- |
| Authorization | string | your Trustcrow API keys to authorize customers |

{% tabs %}
{% tab title="200 transaction info returned successfully" %}

```javascript
{
    "status": true,
    "message": "Transaction info returned successfully",
    "data": {
        "id": "2a3799a7-4dc2-4081-94eb-770bc6048a48",
        "title": "Bag of cement",
        "description": "Purchase of 3 bags of cements",
        "category": "GOODS",
        "sub_category": "Food/beverage/agriculture",
        "transaction_contract_url": "https://trustcrow-dev-docs.s3.amazonaws.com/",
        "status": "RECIPIENT_APPROVED_AWAITING_FUNDING",
        "transaction_originator": "BUYER",
        "buyer_id": "524c35c9-ef73-4a4d-a4ab-97146f3cff95",
        "seller_id": "eeae27bc-3e12-47f4-a6cb-fceaa3013629",
        "source": "api",
        "clientId": "dd2f3541-9047-46e1-b117-6ca8584ea0bd",
        "transaction_amount": 500000,
        "total_amount_funded": 0,
        "total_amount_refunded": 0,
        "total_amount_disbursed": 0,
        "current_milestone_id": null,
        "job_id": null,
        "decline_reason": null,
        "is_completed": false,
        "has_buyer_rated": false,
        "on_last_milestone": true,
        "has_seller_rated": false,
        "discount_code": null,
        "declined_at": null,
        "approved_at": null,
        "created_by": "369ea20c-212b-4b2a-9f87-31c7b11dec58",
        "updated_by": null,
        "date_canceled": null,
        "created_at": "2023-12-26T10:02:35.691Z",
        "updated_at": "2023-12-26T10:02:35.691Z",
        "milestones": [
            {
                "id": "4cc0a406-ad97-4aa6-9f71-bfca4404f1a5",
                "title": "Purchase of 3 bags of cements",
                "description": "Purchase of 3 bags of cements",
                "amount": 500000,
                "is_milestone_funded": false,
                "position_in_transaction": 1,
                "is_delivered": false,
                "is_completed": false,
                "delivery_rejection_reason": null,
                "is_delivery_rejected": false,
                "is_return_proof_sent": false,
                "is_return_approved": false,
                "is_return_rejected": false,
                "due_date_type": "DEADLINE_DATE",
                "due_date": "2023-12-30T00:00:00.000Z",
                "execution_timeline": null,
                "status": "PENDING",
                "commission_payer": "SELLER_100",
                "discount_code": null,
                "milestone_fee": 16250,
                "transaction_id": "2a3799a7-4dc2-4081-94eb-770bc6048a48",
                "inspection_duration": 2,
                "inspection_end_date": null,
                "return_deadline_date": null,
                "current_extension_index": null,
                "milestone_escrow_id": "8991b718-bade-4119-a4b1-e6bec59cd3b2",
                "rate_used": 1,
                "created_at": "2023-12-26T10:02:35.691Z",
                "updated_at": "2023-12-26T10:02:35.691Z"
            }
        ]
    }
}
```

{% endtab %}
{% endtabs %}

## Fetch milestone by ID

<mark style="color:blue;">`GET`</mark> `{{api_url}}/v1/milestones/{milestone_id}`

#### Query Parameters

| Name                                            | Type   | Description             |
| ----------------------------------------------- | ------ | ----------------------- |
| milestone\_id<mark style="color:red;">\*</mark> | string | specify the customer id |

#### Headers

| Name          | Type   | Description                                    |
| ------------- | ------ | ---------------------------------------------- |
| Authorization | string | your Trustcrow API keys to authorize customers |

{% tabs %}
{% tab title="200 milestone retrieved successfully" %}

```javascript
{
    "status": true,
    "message": "Milestone retreived successfully",
    "data": {
        "id": "4cc0a406-ad97-4aa6-9f71-bfca4404f1a5",
        "title": "Purchase of 3 bags of cements",
        "description": "Purchase of 3 bags of cements",
        "amount": 500000,
        "is_milestone_funded": false,
        "position_in_transaction": 1,
        "is_delivered": false,
        "is_completed": false,
        "delivery_rejection_reason": null,
        "is_delivery_rejected": false,
        "is_return_proof_sent": false,
        "is_return_approved": false,
        "is_return_rejected": false,
        "due_date_type": "DEADLINE_DATE",
        "due_date": "2023-12-30T00:00:00.000Z",
        "execution_timeline": null,
        "status": "PENDING",
        "commission_payer": "SELLER_100",
        "discount_code": null,
        "milestone_fee": 16250,
        "transaction_id": "2a3799a7-4dc2-4081-94eb-770bc6048a48",
        "inspection_duration": 2,
        "inspection_end_date": null,
        "return_deadline_date": null,
        "current_extension_index": null,
        "milestone_escrow_id": "8991b718-bade-4119-a4b1-e6bec59cd3b2",
        "rate_used": 1,
        "created_at": "2023-12-26T10:02:35.691Z",
        "updated_at": "2023-12-26T10:02:35.691Z",
        "transaction": {
            "id": "2a3799a7-4dc2-4081-94eb-770bc6048a48",
            "title": "Bag of cement",
            "description": "Purchase of 3 bags of cements",
            "category": "GOODS",
            "sub_category": "Food/beverage/agriculture",
            "transaction_contract_url": "https://trustcrow-dev-docs.s3.amazonaws.com/",
            "status": "RECIPIENT_APPROVED_AWAITING_FUNDING",
            "transaction_originator": "BUYER",
            "buyer_id": "524c35c9-ef73-4a4d-a4ab-97146f3cff95",
            "seller_id": "eeae27bc-3e12-47f4-a6cb-fceaa3013629",
            "source": "api",
            "clientId": "dd2f3541-9047-46e1-b117-6ca8584ea0bd",
            "transaction_amount": 500000,
            "total_amount_funded": 0,
            "total_amount_refunded": 0,
            "total_amount_disbursed": 0,
            "current_milestone_id": null,
            "job_id": null,
            "decline_reason": null,
            "is_completed": false,
            "has_buyer_rated": false,
            "on_last_milestone": true,
            "has_seller_rated": false,
            "discount_code": null,
            "declined_at": null,
            "approved_at": null,
            "created_by": "369ea20c-212b-4b2a-9f87-31c7b11dec58",
            "updated_by": null,
            "date_canceled": null,
            "created_at": "2023-12-26T10:02:35.691Z",
            "updated_at": "2023-12-26T10:02:35.691Z",
            "buyer": {
                "id": "524c35c9-ef73-4a4d-a4ab-97146f3cff95",
                "user_id": "369ea20c-212b-4b2a-9f87-31c7b11dec58",
                "organisation_id": "7019af1c-5762-443a-880f-6d950f31ce9f",
                "role": "SUPER ADMIN",
                "created_at": "2023-12-26T09:03:18.782Z",
                "updated_at": "2023-12-26T09:03:18.782Z",
                "organisation": {
                    "id": "7019af1c-5762-443a-880f-6d950f31ce9f",
                    "name": "Haleemah Opeyemi's Organisation",
                    "wallet_id": "b78ec8db-4bab-43c3-84a1-a9d55d036d54",
                    "paystack_customer_code": null,
                    "account_kyc_type": null,
                    "is_kyc_completed": false,
                    "is_kyc_submitted": false,
                    "is_kyc_approved": false,
                    "is_kyc_declined": false,
                    "kyc_decline_reason": null,
                    "kyc_completed_at": null,
                    "created_by": "369ea20c-212b-4b2a-9f87-31c7b11dec58",
                    "kyc_approved_by": null,
                    "kyc_declined_by": null,
                    "location_type": "LOCAL",
                    "updated_by": null,
                    "created_at": "2023-12-26T09:03:18.775Z",
                    "updated_at": "2023-12-26T09:03:18.795Z"
                },
                "user": {
                    "id": "369ea20c-212b-4b2a-9f87-31c7b11dec58",
                    "first_name": "Haleemah",
                    "last_name": "Opeyemi",
                    "user_name": "haopho31079",
                    "email": "haleemahfolag@yopmail.com",
                    "default_email": "ec5fe1cf-dcf3-48b9-b003-7417fea0c0f1_haleemahfolag@yopmail.com",
                    "phone": null,
                    "password": null,
                    "is_account_verified": true,
                    "password_reset": false,
                    "role": "USER",
                    "referredById": null,
                    "referral_code": null,
                    "clientId": "ec5fe1cf-dcf3-48b9-b003-7417fea0c0f1",
                    "source": "THIRD_PARTY",
                    "public_key": null,
                    "secret_key": null,
                    "api_enabled": false,
                    "password_created": false,
                    "last_logged_in_at": null,
                    "created_at": "2023-12-26T09:03:18.766Z",
                    "updated_at": "2023-12-26T09:03:18.766Z"
                }
            },
            "seller": {
                "id": "eeae27bc-3e12-47f4-a6cb-fceaa3013629",
                "user_id": "7c4e5b33-eb74-41fd-8f07-230cfaeb2439",
                "organisation_id": "9876d61f-ad34-4d5a-be9d-46bee63c8c4a",
                "role": "SUPER ADMIN",
                "created_at": "2023-12-26T09:56:54.276Z",
                "updated_at": "2023-12-26T09:56:54.276Z",
                "organisation": {
                    "id": "9876d61f-ad34-4d5a-be9d-46bee63c8c4a",
                    "name": "John Doe's Organisation",
                    "wallet_id": "6ba37133-a54b-42d2-af1d-d20e1ed7a13a",
                    "paystack_customer_code": null,
                    "account_kyc_type": null,
                    "is_kyc_completed": false,
                    "is_kyc_submitted": false,
                    "is_kyc_approved": false,
                    "is_kyc_declined": false,
                    "kyc_decline_reason": null,
                    "kyc_completed_at": null,
                    "created_by": "7c4e5b33-eb74-41fd-8f07-230cfaeb2439",
                    "kyc_approved_by": null,
                    "kyc_declined_by": null,
                    "location_type": "LOCAL",
                    "updated_by": null,
                    "created_at": "2023-12-26T09:56:54.268Z",
                    "updated_at": "2023-12-26T09:56:54.292Z"
                },
                "user": {
                    "id": "7c4e5b33-eb74-41fd-8f07-230cfaeb2439",
                    "first_name": "John",
                    "last_name": "Doe",
                    "user_name": "jodojd30278",
                    "email": "joe@yopmail.com",
                    "default_email": "ec5fe1cf-dcf3-48b9-b003-7417fea0c0f1_joe@yopmail.com",
                    "phone": null,
                    "password": null,
                    "is_account_verified": true,
                    "password_reset": false,
                    "role": "USER",
                    "referredById": null,
                    "referral_code": null,
                    "clientId": "ec5fe1cf-dcf3-48b9-b003-7417fea0c0f1",
                    "source": "THIRD_PARTY",
                    "public_key": null,
                    "secret_key": null,
                    "api_enabled": false,
                    "password_created": false,
                    "last_logged_in_at": null,
                    "created_at": "2023-12-26T09:56:54.249Z",
                    "updated_at": "2023-12-26T09:56:54.249Z"
                }
            }
        },
        "milestone_escrow": {
            "id": "8991b718-bade-4119-a4b1-e6bec59cd3b2",
            "balance": 0,
            "created_at": "2023-12-26T10:02:35.691Z",
            "updated_at": "2023-12-26T10:02:35.691Z"
        }
    }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://gotrustcrow.gitbook.io/trustcrow-api-v1/api-reference/transaction/fetch-milestones.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
